From b7d385e812814e433dd45ea342c03b42034d9123 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Sun, 14 Sep 2025 19:13:11 -0700 Subject: [PATCH] automatically label pr for ci (#10435) --- .github/workflows/label-pr.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/label-pr.yml diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml new file mode 100644 index 000000000..86b9ad192 --- /dev/null +++ b/.github/workflows/label-pr.yml @@ -0,0 +1,30 @@ +name: Label PRs for CI + +# This workflow runs on pull requests that are opened or reopened. +on: + pull_request_target: + types: [opened, reopened] + +# Sets the permissions for the GITHUB_TOKEN to allow adding labels. +permissions: + pull-requests: write + +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) + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ['run-ci'] + })