Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

chore: use 1st-party script for blocked-pr.yml (#6085)

Mark Wiemer54aee06a9c49
diff --git a/.github/workflows/blocked-pr.yml b/.github/workflows/blocked-pr.yml
index 0cddad62..19937e8e 100644
--- a/.github/workflows/blocked-pr.yml
+++ b/.github/workflows/blocked-pr.yml
@@ -5,6 +5,12 @@ on:
branches:
- main
types: [opened, reopened, synchronize, labeled, unlabeled]
+ workflow_dispatch:
+ inputs:
+ pr:
+ description: "PR ID"
+ required: true
+ type: string
permissions:
contents: read
@@ -16,9 +22,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Verify "status: blocked" label is not applied'
- uses: mheap/github-action-required-labels@v5
- with:
- mode: exactly
- count: 0
- labels: "status: blocked"
- message: "This PR has the 'status: blocked' label and cannot be merged until that label is removed."
+ if: "github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'status: blocked')"
+ run: |
+ echo "::error::This PR has the 'status: blocked' label and cannot be merged until that label is removed."
+ exit 1
+ - name: 'Verify "status: blocked" label is not applied (manual runs)'
+ if: "github.event_name == 'workflow_dispatch'"
+ env:
+ GH_TOKEN: ${{ github.token }}
+ PR: ${{ inputs.pr }}
+ run: |
+ labels=$(gh pr view "$PR" --repo "$GITHUB_REPOSITORY" --json labels --jq '.labels[].name')
+ if echo "$labels" | grep -qx 'status: blocked'; then
+ echo "::error::PR #$PR has the 'status: blocked' label and cannot be merged until that label is removed."
+ exit 1
+ fi
+ echo "PR #$PR is not blocked."