Skip to content

Commit dfc4930

Browse files
add no label check in ci
Signed-off-by: Jerry Guo <[email protected]>
1 parent 5f07f8c commit dfc4930

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: MPL-2.0
44

55

6-
name: Check Blocking Labels
6+
name: Check PR Labels
77

88
on:
99
# run pipeline on pull request
@@ -19,14 +19,22 @@ on:
1919
workflow_dispatch:
2020

2121
concurrency:
22-
group: ${{ github.workflow }}-${{ github.ref }}-blocking-labels
22+
group: ${{ github.workflow }}-${{ github.ref }}-pr-labels
2323
cancel-in-progress: true
2424

2525
jobs:
26-
check-blocking-labels:
26+
check-pr-labels:
2727
runs-on: ubuntu-latest
2828
steps:
29-
29+
30+
- name: fail-if-no-label
31+
if: github.event_name == 'pull_request'
32+
run: |
33+
if [ "$(jq '.pull_request.labels | length' "$GITHUB_EVENT_PATH")" -eq 0 ]; then
34+
echo "This pull request has no labels. Please add at least one label."
35+
exit 1
36+
fi
37+
3038
- name: do-not-merge
3139
if: contains(github.event.pull_request.labels.*.name, 'do-not-merge')
3240
run: |

0 commit comments

Comments
 (0)