File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 77
88permissions :
99 contents : write
10+ workflows : write
1011
1112jobs :
1213 sync :
13- # 仅在 fork 仓库执行;主仓库没有“ 上游同步” 需求
14+ # 仅在 fork 仓库执行;主仓库没有" 上游同步" 需求
1415 if : github.repository != 'gqy20/IssueLab'
1516 runs-on : ubuntu-latest
1617 steps :
1718 - uses : actions/checkout@v4
1819 with :
1920 fetch-depth : 0
20- token : ${{ secrets.PAT_TOKEN || github.token }}
21+ token : ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
2122 - name : Add upstream
2223 run : |
2324 git remote add upstream https://github.com/gqy20/IssueLab.git || true
2425 git fetch upstream
26+ - name : Configure Git
27+ run : |
28+ git config user.name "github-actions[bot]"
29+ git config user.email "github-actions[bot]@users.noreply.github.com"
2530 - name : Merge upstream/main
2631 run : |
2732 git checkout main
28- git merge upstream/main --ff-only || git merge upstream/main --no-edit
33+ git merge upstream/main --ff-only || git merge upstream/main --no-edit || echo "No changes to merge"
2934 - name : Push
3035 env :
3136 GH_PUSH_TOKEN : ${{ secrets.PAT_TOKEN }}
3237 run : |
33- if [ -z "${GH_PUSH_TOKEN}" ]; then
34- echo "PAT_TOKEN is required for push in sync-upstream workflow." >&2
35- exit 1
38+ if [ -n "${GH_PUSH_TOKEN}" ]; then
39+ git remote set-url origin "https://x-access-token:${GH_PUSH_TOKEN}@github.com/${{ github.repository }}.git"
3640 fi
37- git remote set-url origin "https://x-access-token:${GH_PUSH_TOKEN}@github.com/${{ github.repository }}.git"
38- git push origin main
41+ git push origin main || echo "Nothing to push"
You can’t perform that action at this time.
0 commit comments