Skip to content

Pull Request Triage

Actions
Automatically labelling PR depending on the PR s status
v1.1.0
Latest
Star (7)

Pull Request Triage

build MIT License Language PRs Welcome website Language grade: JavaScript

Automatically labelling PR depending on the PR's status

Usage

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 a workflow_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 }}

How it works

workflow

Only watching the most recent commit 👀:

  • Do nothing when the PR's title starts from WIP, [WIP] or WIP:.
  • 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 got Change request event.
  • Add the PR: review-approved label when the PR has reviewed and got Approve event.

License

The scripts and documentation in this project are released under the MIT License

Pull Request Triage is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Automatically labelling PR depending on the PR s status
v1.1.0
Latest

Pull Request Triage is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.