Skip to content

Commit 2f4a700

Browse files
[release/8.0-staging] Add workflow to prevent merging a PR when the NO-MERGE label is applied (#111962)
* Add workflow to prevent merging a PR when the `NO-MERGE` label is applied. * Invert condition * Fix backtick bug in check-service-labels echo. --------- Co-authored-by: Carlos Sánchez López <[email protected]>
1 parent 1aa0ede commit 2f4a700

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: check-no-merge-label
2+
3+
permissions:
4+
pull-requests: read
5+
6+
on:
7+
pull_request:
8+
types: [opened, edited, reopened, labeled, unlabeled, synchronize]
9+
branches:
10+
- 'main'
11+
- 'release/**'
12+
13+
jobs:
14+
check-labels:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check 'NO-MERGE' label
18+
run: |
19+
echo "Merging permission is disabled when the 'NO-MERGE' label is applied."
20+
if [ "${{ contains(github.event.pull_request.labels.*.name, 'NO-MERGE') }}" = "false" ]; then
21+
exit 0
22+
else
23+
echo "::error:: The 'NO-MERGE' label was applied to the PR. Merging is disabled."
24+
exit 1
25+
fi

.github/workflows/check-service-labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- name: Check 'Servicing-approved' label
1717
run: |
18-
echo "Merging permission is enabled for servicing PRs when the `Servicing-approved` label is applied."
18+
echo "Merging permission is enabled for servicing PRs when the 'Servicing-approved' label is applied."
1919
if [ "${{ contains(github.event.pull_request.labels.*.name, 'Servicing-approved') }}" = "true" ]; then
2020
exit 0
2121
else

0 commit comments

Comments
 (0)