Skip to content

Commit b96527b

Browse files
authored
build: check for PR labels (#1342)
1 parent 32e22ec commit b96527b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/label.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Check PR Label
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, labeled, unlabeled]
6+
7+
jobs:
8+
check-label:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check out the repository
13+
uses: actions/checkout@v4
14+
15+
- name: Check if PR has labels
16+
id: check_labels
17+
run: |
18+
labels=$(jq -r '.pull_request.labels | length' $GITHUB_EVENT_PATH)
19+
if [ "$labels" -eq 0 ]; then
20+
echo "No labels found on the PR"
21+
exit 1
22+
fi
23+
24+
- name: Set status
25+
if: failure()
26+
run: echo "Please add at least one label to the Pull Request."

0 commit comments

Comments
 (0)