Skip to content

Commit 97c6751

Browse files
committed
ci: Fix DNM action
The action fails even when there is no DNM label. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
1 parent 25ff751 commit 97c6751

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/dnm.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@ on:
66

77
jobs:
88
do-not-merge:
9-
if: ${{ contains(github.event.*.labels.*.name, 'DNM') }}
109
name: Prevent Merging
1110
runs-on: ubuntu-24.04
1211
steps:
13-
- name: Check for label
12+
- name: Check for DNM label
13+
id: check-label
14+
run: |
15+
labels_json='${{ toJSON(github.event.pull_request.labels) }}'
16+
if echo "$labels_json" | grep -q '"name":"DNM"'; then
17+
echo "has_dnm=true" >> $GITHUB_OUTPUT
18+
else
19+
echo "has_dnm=false" >> $GITHUB_OUTPUT
20+
fi
21+
22+
- name: Fail if DNM label exists
23+
if: steps.check-label.outputs.has_dnm == 'true'
1424
run: |
1525
echo "Pull request is labeled as 'DNM'"
1626
echo "This workflow fails so that the pull request cannot be merged"

0 commit comments

Comments
 (0)