forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (48 loc) · 1.94 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
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:
- uses: mheap/github-action-required-labels@v1
name: Check release notes label
id: required_label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: exactly
count: 0
labels: "release notes (needs details)"
- name: Print helper
if: failure() && steps.required_label.outcome == 'failure'
run: |
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 "('./doc/releasenotes/12_0_0_summary.md')". Once documented, the "release notes (needs details)" label can be removed.
exit 1
- 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