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'] })