We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e87941e + 1d8953e commit f62b0caCopy full SHA for f62b0ca
.github/workflows/labels.yml
@@ -0,0 +1,24 @@
1
+name: Check PR Labels
2
+
3
+on:
4
+ pull_request:
5
+ types: [opened, labeled, unlabeled, synchronize]
6
7
+jobs:
8
+ check_labels:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Check PR Labels
12
+ uses: actions/github-script@v6
13
+ with:
14
+ script: |
15
+ const allowedPattern = /^(major|minor|patch|performance|internal|documentation|tests|dependencies)$/;
16
17
+ const labels = context.payload.pull_request.labels.map(label => label.name);
18
19
+ const hasValidLabel = labels.some(label => allowedPattern.test(label));
20
+ if (!hasValidLabel) {
21
+ core.setFailed("The pull request must have a label of 'major', 'minor', or 'patch'.");
22
+ } else {
23
+ console.log('PR has a valid label.');
24
+ }
0 commit comments