Add block creations field to github branch protection scaffolder action
Signed-off-by: Praphull <1288395+praphull-purohit@users.noreply.github.com>
This commit is contained in:
@@ -44,6 +44,7 @@ type BranchProtectionOptions = {
|
||||
dismissStaleReviews?: boolean;
|
||||
requiredCommitSigning?: boolean;
|
||||
requiredLinearHistory?: boolean;
|
||||
blockCreations?: boolean;
|
||||
};
|
||||
|
||||
export const enableBranchProtectionOnDefaultRepoBranch = async ({
|
||||
@@ -64,6 +65,7 @@ export const enableBranchProtectionOnDefaultRepoBranch = async ({
|
||||
dismissStaleReviews = false,
|
||||
requiredCommitSigning = false,
|
||||
requiredLinearHistory = false,
|
||||
blockCreations = false,
|
||||
}: BranchProtectionOptions): Promise<void> => {
|
||||
const tryOnce = async () => {
|
||||
try {
|
||||
@@ -96,6 +98,7 @@ export const enableBranchProtectionOnDefaultRepoBranch = async ({
|
||||
},
|
||||
required_conversation_resolution: requiredConversationResolution,
|
||||
required_linear_history: requiredLinearHistory,
|
||||
block_creations: blockCreations,
|
||||
});
|
||||
|
||||
if (requiredCommitSigning) {
|
||||
|
||||
@@ -57,6 +57,7 @@ export function createGithubBranchProtectionAction(options: {
|
||||
requireLastPushApproval: inputProps.requireLastPushApproval,
|
||||
requiredCommitSigning: inputProps.requiredCommitSigning,
|
||||
requiredLinearHistory: inputProps.requiredLinearHistory,
|
||||
blockCreations: inputProps.blockCreations,
|
||||
token: inputProps.token,
|
||||
},
|
||||
},
|
||||
@@ -76,6 +77,7 @@ export function createGithubBranchProtectionAction(options: {
|
||||
requireLastPushApproval = false,
|
||||
requiredCommitSigning = false,
|
||||
requiredLinearHistory = false,
|
||||
blockCreations = false,
|
||||
token: providedToken,
|
||||
} = ctx.input;
|
||||
|
||||
@@ -129,6 +131,7 @@ export function createGithubBranchProtectionAction(options: {
|
||||
dismissStaleReviews,
|
||||
requiredCommitSigning,
|
||||
requiredLinearHistory,
|
||||
blockCreations,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -348,6 +348,14 @@ const requiredLinearHistory = (z: typeof zod) =>
|
||||
})
|
||||
.optional();
|
||||
|
||||
const blockCreations = (z: typeof zod) =>
|
||||
z
|
||||
.boolean({
|
||||
description: `Prevents creation of new branches during push, unless the push is initiated by a user, team, or app (defined in restrictions) which has the ability to push.`,
|
||||
})
|
||||
.default(false)
|
||||
.optional();
|
||||
|
||||
const repoVariables = (z: typeof zod) =>
|
||||
z
|
||||
.record(z.string(), {
|
||||
@@ -449,4 +457,5 @@ export {
|
||||
protectEnforceAdmins,
|
||||
bypassPullRequestAllowances,
|
||||
branch,
|
||||
blockCreations,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user