mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-18 14:13:42 +00:00
Update bypass label handling in PR template check
This commit is contained in:
1 parent
1e13e008ee
commit
43ad213be8
1 file changed
+3
-3
@@ -5,10 +5,10 @@ const authorUsername = process.env.PR_AUTHOR || "";
|
|||||||
const authorId = Number(process.env.PR_AUTHOR_ID);
|
const authorId = Number(process.env.PR_AUTHOR_ID);
|
||||||
const labels = JSON.parse(process.env.PR_LABELS || "[]");
|
const labels = JSON.parse(process.env.PR_LABELS || "[]");
|
||||||
|
|
||||||
const BYPASS_LABEL = "ci: bypass-template-check";
|
const BYPASS_LABELS = ["ci: bypass-template-check", "maintainer"];
|
||||||
|
|
||||||
const isTrustedUser = trustedUsers.some((u) => u.id === authorId);
|
const isTrustedUser = trustedUsers.some((u) => u.id === authorId);
|
||||||
const hasBypassLabel = labels.includes(BYPASS_LABEL);
|
const hasBypassLabel = labels.some((l) => BYPASS_LABELS.includes(l));
|
||||||
|
|
||||||
if (isTrustedUser) {
|
if (isTrustedUser) {
|
||||||
console.log(`PR author "${authorUsername}" is a trusted user. Skipping template validation.`);
|
console.log(`PR author "${authorUsername}" is a trusted user. Skipping template validation.`);
|
||||||
@@ -16,7 +16,7 @@ if (isTrustedUser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hasBypassLabel) {
|
if (hasBypassLabel) {
|
||||||
console.log(`PR has the "${BYPASS_LABEL}" label. Skipping template validation.`);
|
console.log(`PR has a label which bypasses this check. Skipping template validation.`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user