Skip to content

Commit 6e5a7e3

Browse files
committed
Check if changelog exists
1 parent 3945f8f commit 6e5a7e3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/clippy_bors.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,30 @@ env:
1616
GHA_CI: 1
1717

1818
jobs:
19+
changelog:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/[email protected]
25+
with:
26+
ref: ${{ github.ref }}
27+
- name: Check Changelog
28+
run: |
29+
MESSAGE=$(git log --format=%B -n 1)
30+
PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
31+
output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
32+
python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
33+
grep "^changelog: " | \
34+
sed "s/changelog: //g")
35+
if [[ -z "$output" ]]; then
36+
echo "ERROR: PR body must contain 'changelog: ...'"
37+
exit 1
38+
elif [[ "$output" = "none" ]]; then
39+
echo "WARNING: changelog is 'none'"
40+
fi
1941
base:
42+
needs: changelog
2043
strategy:
2144
matrix:
2245
os: [ubuntu-latest, windows-latest, macos-latest]

0 commit comments

Comments
 (0)