From 253136fba7739a94d3c476102f5e736f4cd1874f Mon Sep 17 00:00:00 2001 From: Eugene Sh Date: Fri, 2 Jul 2021 22:17:32 +0300 Subject: [PATCH] Make branch protection attempt less restrictive In case if something wrong happens along the way when trying to apply protection of a newly created branch - log error, instead of throwing an it, making scaffolder exit with non-zero exit code. This one addresses the issue #6330 Signed-off-by: Eugene S --- .changeset/wet-queens-deny.md | 5 +++++ .../src/scaffolder/actions/builtin/publish/github.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/wet-queens-deny.md diff --git a/.changeset/wet-queens-deny.md b/.changeset/wet-queens-deny.md new file mode 100644 index 0000000000..1e446c619c --- /dev/null +++ b/.changeset/wet-queens-deny.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': patch +--- + +removing mandatory of protection for the default branch, that could be handled by the GitHub automation in async manner, thus throwing floating errors diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/github.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/github.ts index 856197a808..7dd790cb62 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/github.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/github.ts @@ -268,8 +268,8 @@ export function createPublishGithubAction(options: { defaultBranch, }); } catch (e) { - throw new Error( - `Failed to add branch protection to '${newRepo.name}', ${e}`, + ctx.logger.warn( + `Skipping: default branch protection on '${newRepo.name}', ${e.message}`, ); }