refactor(tests): update script paths to use dynamic repository root for better portability
This commit is contained in:
17
.github/workflows/pr-checklist.yml
vendored
17
.github/workflows/pr-checklist.yml
vendored
@@ -31,16 +31,15 @@ jobs:
|
||||
return;
|
||||
}
|
||||
|
||||
// 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,
|
||||
// Use a set of named checks with robust regex patterns for checkbox and phrase variants
|
||||
const checks = [
|
||||
{ name: 'preview_removals.sh mention', pattern: /preview_removals\.sh/i },
|
||||
{ name: 'data/backups mention', pattern: /data\/?backups/i },
|
||||
// Accept checked checkbox variants and inline code/backtick usage for the '--force' phrase
|
||||
{ name: 'explicit non-run of --force', pattern: /(?:\[\s*[xX]\s*\]\s*)?(?:i will not run|will not run|do not run|don'?t run|won'?t run)\b[^\n]*--force/i },
|
||||
];
|
||||
const missing = requiredPatterns
|
||||
.map(p => ({ pattern: p, found: p.test(body) }))
|
||||
.filter(x => !x.found)
|
||||
.map(x => x.pattern.source);
|
||||
|
||||
const missing = checks.filter(c => !c.pattern.test(body)).map(c => c.name);
|
||||
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