Skip to content

Commit 5ae83cd

Browse files
authored
Update README.md
1 parent 49adc86 commit 5ae83cd

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,46 @@
11
# Force-Label
22
Github Action that forces developers to add labels to their PR before it is merged.
3+
4+
## Required Labels
5+
To have multiple required labels you can use `||`:
6+
7+
```
8+
jobs:
9+
check-labels:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Labels not added (bug, documentation, enhancement)
14+
if: >
15+
contains(github.event.pull_request.labels.*.name, 'bug') == false ||
16+
contains(github.event.pull_request.labels.*.name, 'allocations') == false ||
17+
contains(github.event.pull_request.labels.*.name, 'fe') == false
18+
run: exit 1
19+
```
20+
21+
## Layered Labels
22+
To require labels specific to parent labels you can use `needs`
23+
24+
```
25+
jobs:
26+
check-bug:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v3
30+
- name: Labels not added (bug)
31+
if: >
32+
contains(github.event.pull_request.labels.*.name, 'bug') == false &&
33+
run: exit 1
34+
35+
check-sev:
36+
runs-on: ubuntu-latest
37+
needs: check-bug
38+
steps:
39+
- uses: actions/checkout@v3
40+
- name: Labels not added (sev1, sev2, sev3)
41+
if: >
42+
contains(github.event.pull_request.labels.*.name, 'sev1') == false &&
43+
contains(github.event.pull_request.labels.*.name, 'sev2') == false &&
44+
contains(github.event.pull_request.labels.*.name, 'sev3') == false
45+
run: exit 1
46+
```

0 commit comments

Comments
 (0)