about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2025-05-05 15:55:12 +0000
committerGitHub <noreply@github.com>2025-05-05 15:55:12 +0000
commitf60d7f9fc24d7c5ec5123b2affad6fe16bbcd075 (patch)
treedee887bbdd62c358b2cf5d9fed829da65f3f6a6e
parent689e62b3b20f383d7009db7fcff580f0b0eb5f08 (diff)
parente21b9367707e239fb2ba8d31b1e98488f7d6a993 (diff)
downloadrust-f60d7f9fc24d7c5ec5123b2affad6fe16bbcd075.tar.gz
rust-f60d7f9fc24d7c5ec5123b2affad6fe16bbcd075.zip
Read PR body from event in clippy_changelog action (#14736)
Simplifies the implementation a bit, also makes the message an error
annotation

changelog: none
-rw-r--r--.github/workflows/clippy_changelog.yml17
1 files changed, 4 insertions, 13 deletions
diff --git a/.github/workflows/clippy_changelog.yml b/.github/workflows/clippy_changelog.yml
index 1e97154bf8a..4d84d6b6dae 100644
--- a/.github/workflows/clippy_changelog.yml
+++ b/.github/workflows/clippy_changelog.yml
@@ -15,27 +15,18 @@ jobs:
   changelog:
     runs-on: ubuntu-latest
 
-    defaults:
-      run:
-        shell: bash
-
     steps:
     # Run
     - name: Check Changelog
       if: ${{ github.event_name == 'pull_request' }}
       run: |
-        body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" | \
-          python -c "import sys, json; print(json.load(sys.stdin)['body'])")
-        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."
+        if [[ -z $(grep -oP 'changelog: *\K\S+' <<< "$PR_BODY") ]]; then
+          echo "::error::Pull request message must contain 'changelog: ...' with your changelog. Please add it."
           exit 1
-        else
-          echo "changelog: $output"
         fi
       env:
-        PYTHONIOENCODING: 'utf-8'
-        PR_NUMBER: '${{ github.event.number }}'
+        PR_BODY: ${{ github.event.pull_request.body }})
+
 
   # We need to have the "conclusion" job also on PR CI, to make it possible
   # to add PRs to a merge queue.