Check if changelog exists

This commit is contained in:
flip1995 2020-01-21 21:40:40 +01:00
parent 1717a6f7d5
commit ff8336b0a0
No known key found for this signature in database
GPG key ID: 693086869D506637

View file

@ -16,7 +16,30 @@ env:
GHA_CI: 1
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.0.0
with:
ref: ${{ github.ref }}
- name: Check Changelog
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
echo "ERROR: PR body must contain 'changelog: ...'"
exit 1
elif [[ "$output" = "none" ]]; then
echo "WARNING: changelog is 'none'"
fi
base:
needs: changelog
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]