-
Notifications
You must be signed in to change notification settings - Fork 1.2k
57 lines (55 loc) · 1.8 KB
/
label-analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
name: "Label analysis"
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- "[0-9]+.[0-9]+.x"
jobs:
team-label:
if: github.triggering_actor != 'dd-devflow[bot]'
runs-on: ubuntu-latest
steps:
- name: Check team assignment
run: |
labels="${{join(github.event.pull_request.labels.*.name, ' ')}}"
for label in $labels; do
if [[ "$label" =~ ^qa/ ]]; then
echo "A label to skip QA is set -- no need for team assignment"
exit 0
fi
if [[ "$label" =~ ^team/ && "$label" != team/triage ]]; then
echo "Team label found: $label"
exit 0
fi
done
echo "PR ${{github.event.number}} requires at least one non-triage team assignment label (label starting by 'team/')"
exit 1
skip-qa:
if: github.triggering_actor != 'dd-devflow[bot]'
runs-on: ubuntu-latest
steps:
- name: Check ability to skip qa
run: |
skip=0
done=0
noChange=0
labels="${{join(github.event.pull_request.labels.*.name, ' ')}}"
for label in $labels; do
if [[ "$label" == "qa/skip-qa" ]]; then
skip=1
fi
if [[ "$label" == "qa/done" ]]; then
done=1
fi
if [[ "$label" == "qa/no-code-change" ]]; then
noChange=1
fi
done
if [[ ($skip -eq 0 && $done -eq 0 && $noChange -eq 0) || ($skip -eq 1 && $done -ne $noChange) ]]; then
exit 0
else
echo "Skip QA labels are not correct on PR ${{github.event.number}}. You must set `qa/skip-qa` with exacly 1 justification, `qa/done` or `qa/no-code-change`"
exit 1
fi