fix(pr-checklist): improve checklist validation with regex patterns for robustness
This commit is contained in:
12
.github/workflows/pr-checklist.yml
vendored
12
.github/workflows/pr-checklist.yml
vendored
@@ -31,8 +31,16 @@ jobs:
|
||||
return;
|
||||
}
|
||||
|
||||
const required = [ 'preview_removals.sh', 'data/backups', "i will not run the destructive --force" ];
|
||||
const missing = required.filter(r => !body.toLowerCase().includes(r.toLowerCase()));
|
||||
// Use regex patterns to be robust against checkbox formatting or minor phrasing changes
|
||||
const requiredPatterns = [
|
||||
/preview_removals\.sh/i,
|
||||
/data\/?backups/i,
|
||||
/(i will not run|will not run|do not run|don't run|won't run).+--force/i,
|
||||
];
|
||||
const missing = requiredPatterns
|
||||
.map(p => ({ pattern: p, found: p.test(body) }))
|
||||
.filter(x => !x.found)
|
||||
.map(x => x.pattern.source);
|
||||
if (missing.length > 0) {
|
||||
// Post a comment to the PR with instructions for filling the checklist
|
||||
const commentBody = `Hi! This PR touches history-rewrite artifacts and requires the checklist in .github/PULL_REQUEST_TEMPLATE/history-rewrite.md. The following items are missing in your PR body: ${missing.join(', ')}\n\nPlease update the PR description using the history-rewrite template and re-run checks.`;
|
||||
|
||||
Reference in New Issue
Block a user