about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/clippy_bors.yml23
1 files changed, 23 insertions, 0 deletions
diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml
index 6a6d58410f9..2267b46f9fc 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]