Merge pull request #5822 from vvoland/pr-changelog-desc

gha: Mirror PR template and validate PR workflow from moby
This commit is contained in:
Sebastiaan van Stijn 2025-02-13 13:55:00 +01:00 committed by GitHub
commit b2ac898781
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 11 deletions

View File

@ -19,11 +19,14 @@ Provide the following information:
**- How to verify it** **- How to verify it**
**- Description for the changelog** **- Human readable description for the release notes**
<!-- <!--
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: It must be placed inside the below triple backticks section.
NOTE: Only fill this section if changes introduced in this PR are user-facing.
The PR must have a relevant impact/ label.
--> -->
```markdown changelog ```markdown changelog

View File

@ -16,6 +16,7 @@ on:
jobs: jobs:
check-area-label: check-area-label:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
timeout-minutes: 120 # guardrails timeout for the whole job
steps: steps:
- name: Missing `area/` label - name: Missing `area/` label
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/') if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
@ -26,9 +27,10 @@ jobs:
run: exit 0 run: exit 0
check-changelog: check-changelog:
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/')
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
timeout-minutes: 120 # guardrails timeout for the whole job
env: env:
HAS_IMPACT_LABEL: ${{ contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') }}
PR_BODY: | PR_BODY: |
${{ github.event.pull_request.body }} ${{ github.event.pull_request.body }}
steps: steps:
@ -40,15 +42,23 @@ jobs:
# Strip empty lines # Strip empty lines
desc=$(echo "$block" | awk NF) desc=$(echo "$block" | awk NF)
if [ -z "$desc" ]; then if [ "$HAS_IMPACT_LABEL" = "true" ]; then
echo "::error::Changelog section is empty. Provide a description for the changelog." if [ -z "$desc" ]; then
exit 1 echo "::error::Changelog section is empty. Please provide a description for the changelog."
fi exit 1
fi
len=$(echo -n "$desc" | wc -c) len=$(echo -n "$desc" | wc -c)
if [[ $len -le 6 ]]; then if [[ $len -le 6 ]]; then
echo "::error::Description looks too short: $desc" echo "::error::Description looks too short: $desc"
exit 1 exit 1
fi
else
if [ -n "$desc" ]; then
echo "::error::PR has a changelog description, but no changelog label"
echo "::error::Please add the relevant 'impact/' label to the PR or remove the changelog description"
exit 1
fi
fi fi
echo "This PR will be included in the release notes with the following note:" echo "This PR will be included in the release notes with the following note:"
@ -56,6 +66,7 @@ jobs:
check-pr-branch: check-pr-branch:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
timeout-minutes: 120 # guardrails timeout for the whole job
env: env:
PR_TITLE: ${{ github.event.pull_request.title }} PR_TITLE: ${{ github.event.pull_request.title }}
steps: steps: