mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-11 03:13:35 +00:00
Implement bypass for PR template validation
Added logic to bypass PR template validation for trusted users and specific labels.
This commit is contained in:
1 parent
91e9381a9d
commit
c6f9604609
1 file changed
+9
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user