We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 003cd72 commit 2244eb6Copy full SHA for 2244eb6
.github/workflows/pr-label-check.yml
@@ -0,0 +1,29 @@
1
+name: Enforce PR Label
2
+
3
+on:
4
+ pull_request:
5
+ types: [opened, edited, unlabeled]
6
7
+jobs:
8
+ check-label:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Check for labels
12
+ uses: actions/github-script@v6
13
+ with:
14
+ script: |
15
+ const labels = context.payload.pull_request.labels;
16
+ if (labels.length === 0) {
17
+ throw new Error('This pull request must have at least one label.');
18
+ }
19
+ - name: Comment on missing labels
20
+ if: failure()
21
22
23
24
+ github.issues.createComment({
25
+ issue_number: context.issue.number,
26
+ owner: context.repo.owner,
27
+ repo: context.repo.repo,
28
+ body: 'This pull request must have at least one label.'
29
+ })
0 commit comments