From ff8336b0a04237f3c151dd59cd915ad8eedfa093 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 21 Jan 2020 21:40:40 +0100 Subject: [PATCH] Check if changelog exists --- .github/workflows/clippy_bors.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index 6a6d58410..2267b46f9 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -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]