ci: fix sync workflow by using PAT for checkout (#12338)

The GITHUB_TOKEN cannot push changes to .github/workflows/ files due to
GitHub's security restrictions. The 'workflows' permission key added in
the previous commit is not a valid workflow permission scope.

Fix: Use secrets.GH_TOKEN (PAT with workflow scope) in the checkout step
so that git push has the necessary credentials to push branches that
contain workflow file changes (e.g. from merge conflicts).

Also reverts the invalid 'workflows: write' permission.
This commit is contained in:
Arvin Xu 2026-02-15 00:13:13 +08:00 committed by GitHub
parent 03bda41c07
commit 927fe3fd22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,6 @@ on:
permissions:
contents: write
pull-requests: write
workflows: write
jobs:
sync-branches:
@ -18,6 +17,7 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Set up Git
run: |