Skip to content

Commit fc8dc48

Browse files
committed
add workflow Block PRs with "NO-MERGE" label
1 parent 71a8e95 commit fc8dc48

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# .github/workflows/block-no-merge-label.yml
2+
name: Block PRs with "NO-MERGE" label
3+
4+
on:
5+
pull_request:
6+
types: [labeled, unlabeled, synchronize, opened, reopened]
7+
8+
jobs:
9+
check-label:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check for "NO-MERGE" label
13+
uses: actions/github-script@v7
14+
with:
15+
script: |
16+
const labels = await github.rest.issues.listLabelsOnIssue({
17+
owner: context.repo.owner,
18+
repo: context.repo.repo,
19+
issue_number: context.issue.number
20+
});
21+
22+
const hasNoMerge = labels.data.some(label => contains(label.name, 'NO-MERGE'));
23+
24+
if (hasNoMerge) {
25+
core.setFailed('This pull request has a "NO-MERGE" label.');
26+
}

0 commit comments

Comments
 (0)