Implement bypass for PR template validation

Added logic to bypass PR template validation for trusted users and specific labels.
This commit is contained in:
William Harrison authored and GitHub committed 2026-08-19 12:17:46 +08:00
1 parent 91e9381a9d
commit c6f9604609
1 file changed
+9
+9
View File
@@ -3,14 +3,23 @@ const trustedUsers = require("./trusted.json");
const body = process.env.PR_BODY || "";
const authorUsername = process.env.PR_AUTHOR || "";
const authorId = Number(process.env.PR_AUTHOR_ID);
const labels = JSON.parse(process.env.PR_LABELS || "[]");
const BYPASS_LABEL = "ci: bypass-template-check";
const isTrustedUser = trustedUsers.some((u) => u.id === authorId);
const hasBypassLabel = labels.includes(BYPASS_LABEL);
if (isTrustedUser) {
console.log(`PR author "${authorUsername}" is a trusted user. Skipping template validation.`);
process.exit(0);
}
if (hasBypassLabel) {
console.log(`PR has the "${BYPASS_LABEL}" label. Skipping template validation.`);
process.exit(0);
}
const REQUIRED_CHECKBOXES = [
"TOS",
"DOMAIN_STRUCTURE",