Files
OpenFrontIO/.github/workflows/pr-description.yml
Théodore Léon 4443459bc5 Added two checkboxes to the default pull request template (#930)
## Description:

Add the following checks to the pull request template : 
- [ ] I have added relevant tests to the test directory
- [ ] I process any text displayed to the user through translateText()
and i've added it to the en.json file/i

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I have added relevant tests to the test directory
- [x] I process any text displayed to the user through translateText()
and i've added it to the en.json file
- [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

## Please put your Discord username so you can be contacted if a bug or
regression is found:

theodoreleon.aetarax
2025-05-28 20:01:51 -07:00

48 lines
1.7 KiB
YAML

name: 🧼 PR Description
on:
pull_request:
types: [opened, edited, synchronize]
permissions: {}
jobs:
validate-description:
name: Validate Description
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 five boxes are checked
const requiredBoxes = [
/- \[x\] I have added screenshots for all UI updates/i,
/- \[x\] I process any text displayed to the user through translateText\(\) and I\'ve added it to the en\.json file/i,
/- \[x\] I have added relevant tests to the test directory/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.');
}