1616jobs :
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/')
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