mirror of https://github.com/docker/cli.git
ci: Require changelog description
Any PR that is labeled with any `impact/*` label should have a description for the changelog and an `area/*` label. (copied from moby/moby 1d473549e865ef6b90ee936c280f4bda677de39b) Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
b9828336c5
commit
745704d7b4
|
@ -22,9 +22,13 @@ Please provide the following information:
|
||||||
**- Description for the changelog**
|
**- Description for the changelog**
|
||||||
<!--
|
<!--
|
||||||
Write a short (one line) summary that describes the changes in this
|
Write a short (one line) summary that describes the changes in this
|
||||||
pull request for inclusion in the changelog:
|
pull request for inclusion in the changelog.
|
||||||
|
It must be placed inside the below triple backticks section:
|
||||||
-->
|
-->
|
||||||
|
```markdown changelog
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
**- A picture of a cute animal (not mandatory but encouraged)**
|
**- A picture of a cute animal (not mandatory but encouraged)**
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
name: validate-pr
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, edited, labeled, unlabeled]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-area-label:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Missing `area/` label
|
||||||
|
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
|
||||||
|
run: |
|
||||||
|
echo "Every PR with an \`impact/*\` label should also have an \`area/*\` label"
|
||||||
|
exit 1
|
||||||
|
- name: OK
|
||||||
|
run: exit 0
|
||||||
|
|
||||||
|
check-changelog:
|
||||||
|
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/')
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
env:
|
||||||
|
PR_BODY: |
|
||||||
|
${{ github.event.pull_request.body }}
|
||||||
|
steps:
|
||||||
|
- name: Check changelog description
|
||||||
|
run: |
|
||||||
|
# Extract the `markdown changelog` note code block
|
||||||
|
block=$(echo -n "$PR_BODY" | tr -d '\r' | awk '/^```markdown changelog$/{flag=1;next}/^```$/{flag=0}flag')
|
||||||
|
|
||||||
|
# Strip empty lines
|
||||||
|
desc=$(echo "$block" | awk NF)
|
||||||
|
|
||||||
|
if [ -z "$desc" ]; then
|
||||||
|
echo "Changelog section is empty. Please provide a description for the changelog."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
len=$(echo -n "$desc" | wc -c)
|
||||||
|
if [[ $len -le 6 ]]; then
|
||||||
|
echo "Description looks too short: $desc"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "This PR will be included in the release notes with the following note:"
|
||||||
|
echo "$desc"
|
Loading…
Reference in New Issue