name: Sync to Gitea on: push: branches: - '**' # Sync all branches delete: branches: - '**' # Sync branch deletions create: tags: - '**' # Sync tag creation workflow_dispatch: # Allow manual trigger jobs: sync: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch all history for all branches and tags - name: Configure Git run: | git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" - name: Add Gitea remote run: | git remote add gitea https://${{ secrets.GITEA_USERNAME }}:${{ secrets.GITEA_TOKEN }}@${{ secrets.GITEA_URL }} - name: Fetch all branches and tags run: | git fetch --all git fetch --tags - name: Push to Gitea (mirror) run: | git push gitea --mirror --force env: GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" - name: Sync status if: success() run: | echo "✅ Successfully synced to Gitea!" echo "Repository: ${{ secrets.GITEA_URL }}" - name: Sync failed if: failure() run: | echo "❌ Failed to sync to Gitea" echo "Check your Gitea credentials and URL"