Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e84d60d

Browse files
authored
set default PR messages to fail the changelog CI (rust-lang#14069)
I noticed that default PR messages could pass the changelog checking CI. For example, if a PR is submitted without modifying the PR template, the following line is mistakenly treated as a valid changelog by the CI: ``` changelog: [`lint_name`]: your change ``` r? flip1995 changelog: none
2 parents 9135923 + a855136 commit e84d60d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/clippy_changelog.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ jobs:
2626
run: |
2727
body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR_NUMBER" | \
2828
python -c "import sys, json; print(json.load(sys.stdin)['body'])")
29-
output=$(grep "^changelog:\s*\S" <<< "$body" | sed "s/changelog:\s*//g") || {
30-
echo "ERROR: pull request message must contain 'changelog: ...'. Please add it."
29+
output=$(awk '/^changelog:\s*\S/ && !/changelog: \[.*\]: your change/' <<< "$body" | sed "s/changelog:\s*//g")
30+
if [ -z "$output" ]; then
31+
echo "ERROR: pull request message must contain 'changelog: ...' with your changelog. Please add it."
3132
exit 1
32-
}
33-
echo "changelog: $output"
33+
else
34+
echo "changelog: $output"
35+
fi
3436
env:
3537
PYTHONIOENCODING: 'utf-8'
3638
PR_NUMBER: '${{ github.event.number }}'

0 commit comments

Comments
 (0)