From 280611d812290bea3e2413da1dc2553309df06ac Mon Sep 17 00:00:00 2001 From: minto_mathews Date: Fri, 16 May 2025 01:51:19 +0530 Subject: [PATCH] Updated branch restrictions value data type to accpet null due to API failures for some kinds Signed-off-by: minto-mathews-carrier --- .changeset/true-tools-play.md | 5 +++++ .../src/actions/bitbucketCloudBranchRestriction.ts | 4 ++-- .../src/actions/inputProperties.ts | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/true-tools-play.md diff --git a/.changeset/true-tools-play.md b/.changeset/true-tools-play.md new file mode 100644 index 0000000000..4d1ae4d4e8 --- /dev/null +++ b/.changeset/true-tools-play.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend-module-bitbucket-cloud': patch +--- + +Fix `bitbucketCloudBranchRestrictions` API calls to accept null to prevent 400 errors for some branch restriction kinds defined. diff --git a/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/bitbucketCloudBranchRestriction.ts b/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/bitbucketCloudBranchRestriction.ts index d63ccf1b7c..21cec88d25 100644 --- a/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/bitbucketCloudBranchRestriction.ts +++ b/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/bitbucketCloudBranchRestriction.ts @@ -30,7 +30,7 @@ const createBitbucketCloudBranchRestriction = async (opts: { branchMatchKind?: string; branchType?: string; pattern?: string; - value?: number; + value?: number | null; users?: { uuid: string; type: string }[]; groups?: { slug: string; type: string }[]; authorization: { @@ -84,7 +84,7 @@ export function createBitbucketCloudBranchRestrictionAction(options: { branchMatchKind?: string; branchType?: string; pattern?: string; - value?: number; + value?: number | null; users?: { uuid: string }[]; groups?: { slug: string }[]; token?: string; diff --git a/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/inputProperties.ts b/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/inputProperties.ts index cff1457463..6c317a05e0 100644 --- a/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/inputProperties.ts +++ b/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/inputProperties.ts @@ -213,6 +213,7 @@ const restriction = { description: 'The value of the restriction. This field is required when kind is one of require_approvals_to_merge / require_default_reviewer_approvals_to_merge / require_passing_builds_to_merge / require_commits_behind.', type: 'number', + nullable: true, }, users: { title: 'users',