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,