about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2025-01-26 15:28:48 +0000
committerGitHub <noreply@github.com>2025-01-26 15:28:48 +0000
commite84d60daecfe59b6cfaac73fe5e0489cf0b486f2 (patch)
tree338ba93e539836a443447e28a83a13a66f7a815e
parent913592373d40ec6c67774fcf32143bc548b4b6ac (diff)
parenta8551362f2d9a80dbd7227947d7f68c04e3485f1 (diff)
downloadrust-e84d60daecfe59b6cfaac73fe5e0489cf0b486f2.tar.gz
rust-e84d60daecfe59b6cfaac73fe5e0489cf0b486f2.zip
set default PR messages to fail the changelog CI (#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
-rw-r--r--.github/workflows/clippy_changelog.yml10
1 files changed, 6 insertions, 4 deletions
diff --git a/.github/workflows/clippy_changelog.yml b/.github/workflows/clippy_changelog.yml
index 6df5a48c75f..a2657bfea49 100644
--- a/.github/workflows/clippy_changelog.yml
+++ b/.github/workflows/clippy_changelog.yml
@@ -26,11 +26,13 @@ jobs:
       run: |
         body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR_NUMBER" | \
           python -c "import sys, json; print(json.load(sys.stdin)['body'])")
-        output=$(grep "^changelog:\s*\S" <<< "$body" | sed "s/changelog:\s*//g") || {
-          echo "ERROR: pull request message must contain 'changelog: ...'. Please add it."
+        output=$(awk '/^changelog:\s*\S/ && !/changelog: \[.*\]: your change/' <<< "$body" | sed "s/changelog:\s*//g")
+        if [ -z "$output" ]; then
+          echo "ERROR: pull request message must contain 'changelog: ...' with your changelog. Please add it."
           exit 1
-        }
-        echo "changelog: $output"
+        else
+          echo "changelog: $output"
+        fi
       env:
         PYTHONIOENCODING: 'utf-8'
         PR_NUMBER: '${{ github.event.number }}'