about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-14 08:25:14 +0000
committerbors <bors@rust-lang.org>2021-04-14 08:25:14 +0000
commitb1c675f3fc682201cdb28719133285b878e2d157 (patch)
tree0e250ef004978caafe14fc60eaf833af786c2141
parent24921df7bd2cea06aba991909db7c9515799a40b (diff)
parent0d144298eedaf259a6430386b3720d2b7d42211e (diff)
downloadrust-b1c675f3fc682201cdb28719133285b878e2d157.tar.gz
rust-b1c675f3fc682201cdb28719133285b878e2d157.zip
Auto merge of #7070 - camsteffen:changelog-stderr, r=flip1995
Fix changelog check output

Error messages are more helpful if you can see them.

changelog: none
-rw-r--r--.github/workflows/clippy_bors.yml13
1 files changed, 7 insertions, 6 deletions
diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml
index 47253eecc4c..ae6f1aa1b30 100644
--- a/.github/workflows/clippy_bors.yml
+++ b/.github/workflows/clippy_bors.yml
@@ -34,15 +34,16 @@ jobs:
       run: |
         MESSAGE=$(git log --format=%B -n 1)
         PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
-        output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
-          python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
-          grep "^changelog: " | \
-          sed "s/changelog: //g")
-        if [[ -z "$output" ]]; then
+        body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
+          python -c "import sys, json; print(json.load(sys.stdin)['body'])")
+        output=$(grep "^changelog:\s*\S" <<< "$body" | sed "s/changelog:\s*//g") || {
           echo "ERROR: PR body must contain 'changelog: ...'"
           exit 1
-        elif [[ "$output" = "none" ]]; then
+        }
+        if [[ "$output" = "none" ]]; then
           echo "WARNING: changelog is 'none'"
+        else
+          echo "changelog: $output"
         fi
       env:
         PYTHONIOENCODING: 'utf-8'