diff --git a/.gitea/workflows/sync.yml b/.gitea/workflows/sync.yml index ecbb312..85f277d 100644 --- a/.gitea/workflows/sync.yml +++ b/.gitea/workflows/sync.yml @@ -3,13 +3,13 @@ name: Sync to GitHub on: push: branches: - - '**' # Sync all branches + - '**' delete: branches: - - '**' # Sync branch deletions + - '**' create: tags: - - '**' # Sync tag creation + - '**' jobs: sync: @@ -19,34 +19,22 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 0 # Fetch all history for all branches and tags + fetch-depth: 0 - - name: Configure Git + - name: Push to GitHub + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GITHUB_REPO: ${{ secrets.GH_REPO }} 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 + git remote add github https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPO}.git || true + git remote set-url github https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPO}.git + git push github --all --force + git push github --tags --force - name: Sync status if: success() - run: | - echo "✅ Successfully synced to GitHub!" - echo "Repository: github.com/${{ secrets.GH_REPO }}" + run: echo "Successfully synced to GitHub" - name: Sync failed if: failure() - run: | - echo "❌ Failed to sync to GitHub" - echo "Check your GitHub credentials and repository path" \ No newline at end of file + run: echo "Failed to sync to GitHub" \ No newline at end of file