Skip to content

Check for PR labels that block merging #19808

Check for PR labels that block merging

Check for PR labels that block merging #19808

name: 'Check for PR labels that block merging'
on:
pull_request:
types:
- opened
- synchronize
- labeled
- unlabeled
merge_group:
jobs:
ensure-blocking-pr-labels-absent:
if: ${{ github.event_name != 'merge_group' }} # Skip this step for merge_group events
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v2
with:
is-high-risk-environment: false
- name: Run command
uses: actions/github-script@v8
with:
script: |
if (context.payload.pull_request.labels.some((label) => label.name === 'DO-NOT-MERGE')) {
core.setFailed(
"PR cannot be merged because it contains the label 'DO-NOT-MERGE'."
);
}