Skip to content

Commit eaca64a

Browse files
committed
Read PR body from event in clippy_changelog action
1 parent 689e62b commit eaca64a

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

.github/workflows/clippy_changelog.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@ jobs:
2424
- name: Check Changelog
2525
if: ${{ github.event_name == 'pull_request' }}
2626
run: |
27-
body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" | \
28-
python -c "import sys, json; print(json.load(sys.stdin)['body'])")
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."
27+
if [[ -z $(grep -oP 'changelog: *\K\S+' <<< "$PR_BODY") ]]; then
28+
echo '::error::Pull request message must contain 'changelog: ...'. Please add it.'
3229
exit 1
33-
else
34-
echo "changelog: $output"
3530
fi
3631
env:
37-
PYTHONIOENCODING: 'utf-8'
38-
PR_NUMBER: '${{ github.event.number }}'
32+
PR_BODY: ${{ github.event.pull_request.body }})
33+
3934

4035
# We need to have the "conclusion" job also on PR CI, to make it possible
4136
# to add PRs to a merge queue.

0 commit comments

Comments
 (0)