Auto-label PRs #3770
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will triage pull requests and apply a label based on the | |
# paths that are modified in the pull request. | |
name: Auto-label PRs | |
on: | |
pull_request: | |
types: | |
- opened | |
- labeled | |
- unlabeled | |
pull_request_review: | |
types: | |
- submitted | |
env: | |
TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
# Separate jobs can run concurrently | |
jobs: | |
mergeable: | |
name: Label a PR's merge status | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check labels | |
id: block-merge | |
if: | | |
contains(github.event.pull_request.labels.*.name, 'on hold') || | |
contains(github.event.pull_request.labels.*.name, 'work in progress') || | |
contains(github.event.pull_request.labels.*.name, 'blocked') || | |
contains(github.event.pull_request.labels.*.name, 'needs: discussion') || | |
contains(github.event.pull_request.labels.*.name, 'needs: dev discovery') || | |
contains(github.event.pull_request.labels.*.name, 'needs: changelog') || | |
contains(github.event.pull_request.labels.*.name, 'needs: prioritization') || | |
contains(github.event.pull_request.labels.*.name, 'needs: AT updates') || | |
contains(github.event.pull_request.labels.*.name, 'needs: additional info') || | |
contains(github.event.pull_request.labels.*.name, 'needs: code updates') || | |
contains(github.event.pull_request.labels.*.name, 'needs: baseline updates') || | |
contains(github.event.pull_request.labels.*.name, 'needs: documentation updates') || | |
contains(github.event.pull_request.labels.*.name, 'ready: code review') || | |
contains(github.event.pull_request.labels.*.name, 'ready: browser testing') || | |
contains(github.event.pull_request.labels.*.name, 'ready: branch testing') || | |
contains(github.event.pull_request.labels.*.name, 'ready: design review') || | |
github.event.review.state != 'approved' || | |
!contains(github.event.pull_request.labels.*.name, 'AT passed') | |
run: echo "PR not ready to merge." | |
- name: Flag ready to merge | |
# Add a ready to merge label if the PR is approved | |
# ensure the PR is not on hold, in-progress, or blocked & doesn't have any pending | |
# requirements still to do like needing a changelog or AT updates | |
if: steps.block-merge.outcome == 'Skipped' | |
uses: actions-ecosystem/action-add-labels@v1 | |
with: | |
github_token: ${{ env.TOKEN }} | |
labels: ready to merge | |
- name: Remove ready to merge flag | |
# Remove the ready to merge label if the PR is not approved or certain labels are added | |
if: | | |
steps.block-merge.outcome != 'Skipped' && | |
contains(github.event.pull_request.labels.*.name, 'ready to merge') | |
uses: actions-ecosystem/action-remove-labels@v1 | |
with: | |
github_token: ${{ env.TOKEN }} | |
labels: ready to merge |