forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (66 loc) · 3.12 KB
/
release_notes_label.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Check Pull Request labels
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
concurrency:
group: format('{0}-{1}', ${{ github.ref }}, 'Check Pull Request labels')
cancel-in-progress: true
jobs:
check_pull_request_labels:
name: Check Pull Request labels
timeout-minutes: 10
runs-on: ubuntu-latest
if: github.repository == 'vitessio/vitess'
steps:
- name: Release Notes label
run: |
if [[ "${{contains( github.event.pull_request.labels.*.name, 'release notes (needs details)')}}" == "true" ]]; then
echo The "release notes (needs details)" label is set. The changes made in this Pull Request need to be documented in the release notes summary "('./changelog/14.0/14.0.5/summary.md')". Once documented, the "release notes (needs details)" label can be removed.
exit 1
fi
- name: Check type and component labels
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
LABELS_JSON="/tmp/labels.json"
# Get labels for this pull request
curl -s \
-H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-type: application/json" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels" \
> "$LABELS_JSON"
if ! cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'Component:' ; then
echo "Expecting PR to have label 'Component: ...'"
exit 1
fi
if ! cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'Type:' ; then
echo "Expecting PR to have label 'Type: ...'"
exit 1
fi
- name: Check NeedsWebsiteDocsUpdate and NeedsDescriptionUpdate are off
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
LABELS_JSON="/tmp/labels.json"
# Get labels for this pull request
curl -s \
-H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-type: application/json" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels" \
> "$LABELS_JSON"
if cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'NeedsDescriptionUpdate' ; then
echo "Expecting PR to not have the NeedsDescriptionUpdate label, please update the PR's description and remove the label."
exit 1
fi
if cat ${LABELS_JSON} | jq -r '.[].name ' | grep -q 'NeedsWebsiteDocsUpdate' ; then
echo "Expecting PR to not have the NeedsWebsiteDocsUpdate label, please update the documentation and remove the label."
exit 1
fi
- name: Do Not Merge label
run: |
if [[ "${{contains( github.event.pull_request.labels.*.name, 'Do Not Merge')}}" == "true" ]]; then
echo "This PR should not be merged. The 'Do Not Merge' label is set. Please unset it if you wish to merge this PR."
exit 1
fi