refactor(tests): update script paths to use dynamic repository root for better portability

This commit is contained in:
GitHub Actions
2025-12-09 14:27:26 +00:00
parent 320028a64a
commit dfe681dba8
4 changed files with 15 additions and 13 deletions

View File

@@ -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.`;