Skip to content

Commit b2ac898

Browse files
authored
Merge pull request docker#5822 from vvoland/pr-changelog-desc
gha: Mirror PR template and validate PR workflow from moby
2 parents 0eda4c5 + 1edc4e0 commit b2ac898

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ Provide the following information:
1919

2020
**- How to verify it**
2121

22-
**- Description for the changelog**
22+
**- Human readable description for the release notes**
2323
<!--
2424
Write a short (one line) summary that describes the changes in this
2525
pull request for inclusion in the changelog.
26-
It must be placed inside the below triple backticks section:
26+
It must be placed inside the below triple backticks section.
27+
28+
NOTE: Only fill this section if changes introduced in this PR are user-facing.
29+
The PR must have a relevant impact/ label.
2730
-->
2831
```markdown changelog
2932

.github/workflows/validate-pr.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
jobs:
1717
check-area-label:
1818
runs-on: ubuntu-20.04
19+
timeout-minutes: 120 # guardrails timeout for the whole job
1920
steps:
2021
- name: Missing `area/` label
2122
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
@@ -26,9 +27,10 @@ jobs:
2627
run: exit 0
2728

2829
check-changelog:
29-
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/')
3030
runs-on: ubuntu-20.04
31+
timeout-minutes: 120 # guardrails timeout for the whole job
3132
env:
33+
HAS_IMPACT_LABEL: ${{ contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') }}
3234
PR_BODY: |
3335
${{ github.event.pull_request.body }}
3436
steps:
@@ -40,22 +42,31 @@ jobs:
4042
# Strip empty lines
4143
desc=$(echo "$block" | awk NF)
4244
43-
if [ -z "$desc" ]; then
44-
echo "::error::Changelog section is empty. Provide a description for the changelog."
45-
exit 1
46-
fi
45+
if [ "$HAS_IMPACT_LABEL" = "true" ]; then
46+
if [ -z "$desc" ]; then
47+
echo "::error::Changelog section is empty. Please provide a description for the changelog."
48+
exit 1
49+
fi
4750
48-
len=$(echo -n "$desc" | wc -c)
49-
if [[ $len -le 6 ]]; then
50-
echo "::error::Description looks too short: $desc"
51-
exit 1
51+
len=$(echo -n "$desc" | wc -c)
52+
if [[ $len -le 6 ]]; then
53+
echo "::error::Description looks too short: $desc"
54+
exit 1
55+
fi
56+
else
57+
if [ -n "$desc" ]; then
58+
echo "::error::PR has a changelog description, but no changelog label"
59+
echo "::error::Please add the relevant 'impact/' label to the PR or remove the changelog description"
60+
exit 1
61+
fi
5262
fi
5363
5464
echo "This PR will be included in the release notes with the following note:"
5565
echo "$desc"
5666
5767
check-pr-branch:
5868
runs-on: ubuntu-20.04
69+
timeout-minutes: 120 # guardrails timeout for the whole job
5970
env:
6071
PR_TITLE: ${{ github.event.pull_request.title }}
6172
steps:

0 commit comments

Comments
 (0)