From aea8e28d7c27f3ece4be367e0d9a475865b87175 Mon Sep 17 00:00:00 2001 From: Francesco Saltori Date: Tue, 31 May 2022 15:15:57 +0200 Subject: [PATCH] Minor adjustments Signed-off-by: Francesco Saltori --- .changeset/honest-planets-sin.md | 2 +- .../actions/builtin/publish/github.ts | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.changeset/honest-planets-sin.md b/.changeset/honest-planets-sin.md index 5035d8cee4..03a34f7d86 100644 --- a/.changeset/honest-planets-sin.md +++ b/.changeset/honest-planets-sin.md @@ -4,7 +4,7 @@ Fixed bug in `publish:github` action that didn't permit to add users as collaborators. This fix required changing the way parameters are passed to the action. -In order to add a team as collaborator, now you must use the `team` field instead of `user`. +In order to add a team as collaborator, now you must use the `team` field instead of `username`. In order to add a user as collaborator, you must use the `user` field. It's still possible to use the field `username` but is deprecated in favor of `team`. 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 9d3b43dc4f..4237ff1abf 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/github.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/github.ts @@ -355,7 +355,7 @@ export function createPublishGithubAction(options: { }); } else if ('username' in collaborator) { ctx.logger.warn( - 'The field `username` is deprecated in favor of `team`', + 'The field `username` is deprecated in favor of `team` and will be removed in the future.', ); await client.rest.teams.addOrUpdateRepoPermissionsInOrg({ org: owner, @@ -447,20 +447,7 @@ export function createPublishGithubAction(options: { } function extractCollaboratorName( - collaborator: - | { - user: string; - access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; - } - | { - team: string; - access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; - } - | { - /** @deprecated This field is deprecated in favor of team */ - username: string; - access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'; - }, + collaborator: { user: string } | { team: string } | { username: string }, ) { if ('username' in collaborator) return collaborator.username; if ('user' in collaborator) return collaborator.user;