Minor adjustments

Signed-off-by: Francesco Saltori <francescosaltori@gmail.com>
This commit is contained in:
Francesco Saltori
2022-05-31 15:15:57 +02:00
parent 15a3cacaf2
commit aea8e28d7c
2 changed files with 3 additions and 16 deletions
+1 -1
View File
@@ -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`.
@@ -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;