name: Sync to GitHub on: push: branches: - '**' # Sync all branches delete: branches: - '**' # Sync branch deletions create: tags: - '**' # Sync tag creation 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 "Gitea Actions" git config --global user.email "actions@gitea.local" - name: Add GitHub remote run: | git remote add github https://${{ secrets.GH_USERNAME }}:${{ secrets.GH_TOKEN }}@github.com/${{ secrets.GH_REPO }} - name: Fetch all branches and tags run: | git fetch --all git fetch --tags - name: Push to GitHub (mirror) run: | git push github --mirror --force - name: Sync status if: success() run: | echo "✅ Successfully synced to GitHub!" echo "Repository: github.com/${{ secrets.GH_REPO }}" - name: Sync failed if: failure() run: | echo "❌ Failed to sync to GitHub" echo "Check your GitHub credentials and repository path"