mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-20 18:46:38 +08:00
fix: add PAT token
This commit is contained in:
parent
5a0a075d0c
commit
6cfa4c59f6
10
.github/workflows/sync-upstream.yml
vendored
10
.github/workflows/sync-upstream.yml
vendored
@ -11,17 +11,19 @@ jobs:
|
|||||||
permissions: # 添加必要的权限
|
permissions: # 添加必要的权限
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
contents: write
|
contents: write
|
||||||
workflows: write # 添加 workflows 权限
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # 获取完整历史
|
fetch-depth: 0 # 获取完整历史
|
||||||
|
token: ${{ secrets.PAT_TOKEN }} # 使用PAT以便推送分支
|
||||||
|
|
||||||
- name: Sync upstream pull requests
|
- name: Sync upstream pull requests
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.PAT_TOKEN }}
|
||||||
|
# github-token: ${{ secrets.PAT_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const upstream = 'songquanpeng/one-api';
|
const upstream = 'songquanpeng/one-api';
|
||||||
const [owner, repo] = upstream.split('/');
|
const [owner, repo] = upstream.split('/');
|
||||||
@ -45,7 +47,7 @@ jobs:
|
|||||||
page++;
|
page++;
|
||||||
}
|
}
|
||||||
return allPulls;
|
return allPulls;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取所有PR
|
// 获取所有PR
|
||||||
const pulls = await getAllPRs();
|
const pulls = await getAllPRs();
|
||||||
@ -71,7 +73,7 @@ jobs:
|
|||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
head: `${context.repo.owner}:${branchName}`,
|
head: `${context.repo.owner}:${branchName}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (existingPulls.data.length === 0) {
|
if (existingPulls.data.length === 0) {
|
||||||
// 推送分支
|
// 推送分支
|
||||||
|
Loading…
Reference in New Issue
Block a user