feat: handle branch/tag creation
This commit is contained in:
parent
e73128ddf3
commit
a852836a30
|
@ -69,7 +69,7 @@ export default async function filter(
|
|||
return "bot";
|
||||
}
|
||||
|
||||
// ignore branch/tag if configured
|
||||
// ignore branch/tag push
|
||||
const refMatch = /^refs\/([^\/]+)\/(.+)$/.exec(json.ref);
|
||||
if (event === "push" && refMatch) {
|
||||
// check if branch is allowed
|
||||
|
@ -86,5 +86,21 @@ export default async function filter(
|
|||
}
|
||||
}
|
||||
|
||||
// ignore creation of branch/tag
|
||||
if (event === "create") {
|
||||
// check if branch is allowed
|
||||
if (
|
||||
json.ref_type === "branch" && config.allowBranches !== undefined &&
|
||||
!config.allowBranches.includes(json.ref)
|
||||
) {
|
||||
return `branch '${json.ref}' not in ${JSON.stringify(config.allowBranches)}`;
|
||||
}
|
||||
|
||||
// check if it's a tag
|
||||
if (json.ref_type == "tag" && config.hideTags === true) {
|
||||
return `tag '${json.ref}'`;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue