From 8f6a175803c7ad469a31675c00d775757fc7a1c9 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Sun, 14 Sep 2025 19:48:06 -0700 Subject: [PATCH] Fix label pr for ci (#10441) --- .github/workflows/label-pr.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml index 86b9ad192..cf414a441 100644 --- a/.github/workflows/label-pr.yml +++ b/.github/workflows/label-pr.yml @@ -1,6 +1,5 @@ -name: Label PRs for CI +name: Label PR for CI -# This workflow runs on pull requests that are opened or reopened. on: pull_request_target: types: [opened, reopened] @@ -13,12 +12,17 @@ jobs: labeler: runs-on: ubuntu-latest steps: - - name: Add 'run-ci' label for authors with write access - # This 'if' condition checks the PR author's association with the repository. - # It proceeds only if the author is an OWNER, MEMBER, or COLLABORATOR. - if: > - contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), - github.event.pull_request.author_association) + - name: Check user permission + id: checkAccess + uses: actions-cool/check-user-permission@v2 + with: + require: write + username: ${{ github.triggering_actor }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Add run-ci label + if: steps.checkAccess.outputs.require-result == 'true' uses: actions/github-script@v7 with: script: |