diff --git a/.github/workflows/scripts/pr-check-checklist.sh b/.github/workflows/scripts/pr-check-checklist.sh new file mode 100755 index 00000000000..26d78fa2596 --- /dev/null +++ b/.github/workflows/scripts/pr-check-checklist.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +echo "Fetching description..." +PR_BODY=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "$PR_URL" | jq -r '.body') + +echo "Validating checklist..." +CHECKBOXES=$(echo "$PR_BODY" | grep -o '\[.\]') +UNCHECKED=$(echo "$CHECKBOXES" | grep '\[ \]' || true) + +if [ -n "$UNCHECKED" ]; then + echo "❌ Checklist has not been completed" + exit 1 +else + echo "✅ Checked Checklist, all checks checked and checked" +fi \ No newline at end of file diff --git a/.github/workflows/valid-pr-description.yaml b/.github/workflows/valid-pr-description.yaml new file mode 100644 index 00000000000..72e7ff85b78 --- /dev/null +++ b/.github/workflows/valid-pr-description.yaml @@ -0,0 +1,20 @@ +name: Validate Pull Request Description + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + validate-description: + name: Validate Description + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Validate checklist has been completed + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.pull_request.url }} + run: ./.github/workflows/scripts/pr-check-checklist.sh \ No newline at end of file