forked from nrfconnect/ncs-matter
-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (25 loc) · 816 Bytes
/
Copy pathdnm.yml
File metadata and controls
30 lines (25 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: Do Not Merge
on:
pull_request:
types: [synchronize, opened, reopened, labeled, unlabeled]
permissions:
contents: read
pull-requests: read
jobs:
do-not-merge:
name: Prevent Merging
runs-on: ubuntu-24.04
steps:
- name: Check for DNM label
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
labels=$(gh pr view "${{ github.event.pull_request.number }}" \
--repo "${{ github.repository }}" \
--json labels -q '.labels[].name')
if echo "$labels" | grep -qx 'DNM'; then
echo "Pull request is labeled as 'DNM'"
echo "This workflow fails so that the pull request cannot be merged"
exit 1
fi
echo "No DNM label on PR #${{ github.event.pull_request.number }}"