From 3e7fe607e84fdc31bc53090c0af81ca69b698673 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Fri, 16 May 2025 19:18:45 -0400 Subject: [PATCH] PR description check (#766) ## Description: Adds a PR description checker that enforce that the PR template is being followed. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Summary by CodeRabbit - **Chores** - Introduced automated validation for pull request descriptions to ensure required sections and checklist items are completed before merging. --------- Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com> --- .github/workflows/pr-description.yml | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/pr-description.yml diff --git a/.github/workflows/pr-description.yml b/.github/workflows/pr-description.yml new file mode 100644 index 000000000..e96b0b826 --- /dev/null +++ b/.github/workflows/pr-description.yml @@ -0,0 +1,45 @@ +name: ๐Ÿงผ PR Description + +on: + pull_request: + types: [opened, edited, synchronize] + +permissions: {} + +jobs: + validate-description: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + const body = context.payload.pull_request.body || ''; + + const errors = []; + + // Check for ## Description section + const descMatch = body.match(/^## Description:\s*\n((?:(?!^#).*\n?)*)/m); + if (!descMatch || descMatch[1].trim().length < 20) { + errors.push('โŒ Missing or short `## Description:` section.'); + } + + // Check all three boxes are checked + const requiredBoxes = [ + /- \[x\] I have added screenshots for all UI updates/i, + /- \[x\] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced/i, + /- \[x\] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors/i + ]; + + for (const box of requiredBoxes) { + if (!box.test(body)) { + errors.push('โŒ One or more checklist items are not checked.'); + break; + } + } + + if (errors.length > 0) { + core.setFailed(errors.join('\n')); + } else { + console.log('โœ… PR description and checklist look good.'); + }