-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure PR checklist has been completed
- Loading branch information
1 parent
3135635
commit 03971b9
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |