Files
OpenFrontIO/.github/workflows/pr-description.yml
T
Aotumuri d47f5507ee Fix .github/workflows/pr-description.yml to support current PR structure (#1506)
## Description:

This PR fixes an issue in .github/workflows/pr-description.yml where the
logic for detecting checkboxes did not match the current PR format.
The condition was incorrect, so it has been updated to correctly
validate the checkbox state.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA aggreement (only required once).

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

aotumuri
2025-07-20 07:14:36 +00:00

70 lines
2.2 KiB
YAML

name: 🧼 PR
on:
pull_request:
types:
- demilestoned
- edited
- milestoned
- opened
- synchronize
permissions: {}
jobs:
validate-description:
name: Validate Description
runs-on: ubuntu-latest
timeout-minutes: 30
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([\s\S]*?)(?:^## |\Z)/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 have read and accepted the CLA aggreement \(only required once\)\./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.');
}
has-milestone:
name: Has Milestone
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/github-script@v7
with:
script: |
// Get the pull request data
const milestone = context.payload.pull_request.milestone;
if (!milestone) {
core.setFailed('❌ Pull request must have a milestone assigned before merging.');
return;
}
console.log(`✅ Milestone found: ${milestone.title}`);