File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,19 @@ jobs:
34
34
run : |
35
35
MESSAGE=$(git log --format=%B -n 1)
36
36
PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
37
- output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
38
- python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
39
- grep "^changelog: " | \
40
- sed "s/changelog: //g")
37
+ body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
38
+ python -c "import sys, json; print(json.load(sys.stdin)['body'])")
39
+ output=$(grep "^changelog: " <<< "$body" | sed "s/changelog: //g") || {
40
+ echo 'ERROR: Could not find "changelog: ..." in the PR body' >&2
41
+ exit 1
42
+ }
41
43
if [[ -z "$output" ]]; then
42
- echo "ERROR: PR body must contain 'changelog: ...'"
44
+ echo "ERROR: PR body must contain 'changelog: ...'" >&2
43
45
exit 1
44
46
elif [[ "$output" = "none" ]]; then
45
47
echo "WARNING: changelog is 'none'"
48
+ else
49
+ echo "changelog: $output"
46
50
fi
47
51
env :
48
52
PYTHONIOENCODING : ' utf-8'
You can’t perform that action at this time.
0 commit comments