Error out if the release notes section is filled for PRs without the
`impact/` label.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
| ... | ... |
@@ -19,11 +19,14 @@ Please provide the following information: |
| 19 | 19 |
|
| 20 | 20 |
**- How to verify it** |
| 21 | 21 |
|
| 22 |
-**- Description for the changelog** |
|
| 22 |
+**- Human readable description for the release notes** |
|
| 23 | 23 |
<!-- |
| 24 | 24 |
Write a short (one line) summary that describes the changes in this |
| 25 | 25 |
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. |
|
| 27 | 30 |
--> |
| 28 | 31 |
```markdown changelog |
| 29 | 32 |
|
| ... | ... |
@@ -27,10 +27,10 @@ jobs: |
| 27 | 27 |
run: exit 0 |
| 28 | 28 |
|
| 29 | 29 |
check-changelog: |
| 30 |
- if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') |
|
| 31 | 30 |
runs-on: ubuntu-20.04 |
| 32 | 31 |
timeout-minutes: 120 # guardrails timeout for the whole job |
| 33 | 32 |
env: |
| 33 |
+ HAS_IMPACT_LABEL: ${{ contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') }}
|
|
| 34 | 34 |
PR_BODY: | |
| 35 | 35 |
${{ github.event.pull_request.body }}
|
| 36 | 36 |
steps: |
| ... | ... |
@@ -42,15 +42,23 @@ jobs: |
| 42 | 42 |
# Strip empty lines |
| 43 | 43 |
desc=$(echo "$block" | awk NF) |
| 44 | 44 |
|
| 45 |
- if [ -z "$desc" ]; then |
|
| 46 |
- echo "::error::Changelog section is empty. Please provide a description for the changelog." |
|
| 47 |
- exit 1 |
|
| 48 |
- 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 |
|
| 49 | 50 |
|
| 50 |
- len=$(echo -n "$desc" | wc -c) |
|
| 51 |
- if [[ $len -le 6 ]]; then |
|
| 52 |
- echo "::error::Description looks too short: $desc" |
|
| 53 |
- 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 |
|
| 54 | 62 |
fi |
| 55 | 63 |
|
| 56 | 64 |
echo "This PR will be included in the release notes with the following note:" |