From 1b45fbc44289d0b06a68ae058eedc5a1983a4c71 Mon Sep 17 00:00:00 2001 From: Tim Jacomb Date: Thu, 17 Sep 2020 07:25:27 +0100 Subject: [PATCH] Simplify code --- .../src/scaffolder/stages/publish/github.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts index 57a1fca8d9..1d5c9e1947 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts @@ -61,7 +61,6 @@ export class GithubPublisher implements PublisherBase { values: RequiredTemplateValues & Record, ) { const [owner, name] = values.storePath.split('/'); - const access = values.access as string; const user = await this.client.users.getByUsername({ username: owner }); @@ -80,7 +79,8 @@ export class GithubPublisher implements PublisherBase { const { data } = await repoCreationPromise; - if (access && access.match(new RegExp(`${owner}/.+`))) { + const access = values.access as string; + if (access?.startsWith(`${owner}/`)) { const [, team] = access.split('/'); await this.client.teams.addOrUpdateRepoPermissionsInOrg({ org: owner,