From 6cfa4c59f6421b7e441634dcd09a7f89d991fc28 Mon Sep 17 00:00:00 2001 From: sagitchu Date: Tue, 18 Mar 2025 20:34:59 +0800 Subject: [PATCH] fix: add PAT token --- .github/workflows/sync-upstream.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index cb2606de..958f1666 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -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) { // 推送分支