GitHub Action
Pull Request Triage
v1.1.0
Latest version
Automatically labelling PR depending on the PR's status
Step 1. Create a .github/workflows/pr-triage-dummy.yml
file in you repository.
Github actions can not access secrets in
pull_request_review
event, so we need to create a dryrun workflow to triggers aworkflow_run
. Then we can process the event in Step 2.@see How to use secret in pull_request_review similar to pull_request_target?
name: PR Triage Dummy
on:
pull_request_review:
types: [submitted, dismissed]
jobs:
dummy:
runs-on: ubuntu-latest
steps:
- run: echo "this is a dummy workflow that triggers a workflow_run; it's necessary because otherwise the repo secrets will not be in scope for externally forked pull requests"
Step 2. Create a .github/workflows/pr-triage.yml
file in you repository.
name: PR Triage
on:
pull_request_target:
types: [opened, closed, edited, reopened, synchronize, ready_for_review]
workflow_run:
workflows: ['PR Triage Dummy'] # the workflow in step 1
types: [requested]
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/pr-triage@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKFLOW_ID: ${{ github.event.workflow_run.id }}
Only watching the most recent commit 👀:
- Do nothing when the PR's title starts from
WIP
,[WIP]
orWIP:
. - Add the
PR: unreviewed
label when the PR does not have any reviews. - Add the
PR: reviewed-changes-requested
label when the PR has reviewed and gotChange request
event. - Add the
PR: review-approved
label when the PR has reviewed and gotApprove
event.
The scripts and documentation in this project are released under the MIT License