diff --git a/.github/workflows/label_pr_merged.yml b/.github/workflows/label_pr_merged.yml index 0643cb0164..e58f233510 100644 --- a/.github/workflows/label_pr_merged.yml +++ b/.github/workflows/label_pr_merged.yml @@ -2,11 +2,10 @@ name: Add "for test" Label on: - pull_request: + pull_request_target: types: - closed -# 注意, fork 的仓库无法使用 GITHUB_TOKEN 权限,需要单独配置 github-token permissions: pull-requests: read issues: write @@ -20,13 +19,10 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - with: - token: ${{ secrets.WORKFLOW_ACTION_TOKEN }} - name: Get PR commits messages id: pr-commits uses: actions/github-script@v6 with: - github-token: ${{ secrets.WORKFLOW_ACTION_TOKEN }} script: | const { data: commits } = await github.rest.pulls.listCommits({ owner: context.repo.owner, @@ -42,7 +38,6 @@ jobs: - name: Add label to issues uses: actions/github-script@v6 with: - github-token: ${{ secrets.WORKFLOW_ACTION_TOKEN }} script: | for (const issue_id of ${{ steps.pr-commits.outputs.issue_id_list }}) { const { data: labels } = await github.rest.issues.listLabelsOnIssue({ @@ -74,7 +69,6 @@ jobs: close_issue: needs: add_label runs-on: ubuntu-latest - strategy: matrix: issue_id: ${{ fromJSON(needs.add_label.outputs.issue_id_list) }} @@ -82,7 +76,6 @@ jobs: - name: Close Issue ${{ matrix.issue_id }} uses: peter-evans/close-issue@v3 with: - token: ${{ secrets.WORKFLOW_ACTION_TOKEN }} issue-number: ${{ matrix.issue_id }} comment: Auto close issue after pr merged \#${{ github.event.number }}