automatically label pr for ci (#10435)
This commit is contained in:
30
.github/workflows/label-pr.yml
vendored
Normal file
30
.github/workflows/label-pr.yml
vendored
Normal file
@@ -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']
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user