fix: add PAT token

This commit is contained in:
sagitchu 2025-03-18 20:34:59 +08:00
parent 5a0a075d0c
commit 6cfa4c59f6

View File

@ -11,17 +11,19 @@ jobs:
permissions: # 添加必要的权限
pull-requests: write
contents: write
workflows: write # 添加 workflows 权限
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # 获取完整历史
token: ${{ secrets.PAT_TOKEN }} # 使用PAT以便推送分支
- name: Sync upstream pull requests
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.PAT_TOKEN }}
# github-token: ${{ secrets.PAT_TOKEN }}
script: |
const upstream = 'songquanpeng/one-api';
const [owner, repo] = upstream.split('/');
@ -45,7 +47,7 @@ jobs:
page++;
}
return allPulls;
}
}
// 获取所有PR
const pulls = await getAllPRs();
@ -71,7 +73,7 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
head: `${context.repo.owner}:${branchName}`,
});
});
if (existingPulls.data.length === 0) {
// 推送分支