From 7806decbc4e19f4338600695a177efdea24f1e87 Mon Sep 17 00:00:00 2001 From: Tim Jacomb Date: Wed, 16 Sep 2020 14:09:54 +0100 Subject: [PATCH] Make access optional --- .../src/scaffolder/stages/publish/github.ts | 4 ++-- .../scaffolder/src/components/TemplatePage/TemplatePage.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts index 09cb720ebe..b50d5730fb 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts @@ -55,7 +55,7 @@ export class GithubPublisher implements PublisherBase { const { data } = await repoCreationPromise; - if (access.match(new RegExp(`${owner}/.+`))) { + if (access && access.match(new RegExp(`${owner}/.+`))) { const [, team] = access.split('/'); await this.client.teams.addOrUpdateRepoPermissionsInOrg({ org: owner, @@ -66,7 +66,7 @@ export class GithubPublisher implements PublisherBase { }); } else { // no need to add access if it's the person who own's the personal account - if (access !== owner) { + if (access && access !== owner) { await this.client.repos.addCollaborator({ owner, repo: name, diff --git a/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx b/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx index 60f74e4cbe..0f8ceb7a4e 100644 --- a/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx +++ b/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx @@ -54,7 +54,7 @@ const useTemplate = ( const OWNER_REPO_SCHEMA = { $schema: 'http://json-schema.org/draft-07/schema#' as const, - required: ['storePath', 'owner', 'access'], + required: ['storePath', 'owner'], properties: { owner: { type: 'string' as const,