chore: tweak the action a little bit

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-02-13 13:26:21 +01:00
parent a9027dd983
commit ff3057c5af
4 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/plugin-scaffolder-backend-module-gitlab': patch
---
Establishing compatibility of scaffolder action gitlab:projectAccessToken:create with GitLab version ^16 by introducing the expired at parameter.
Use the Gitbeaker library for `gitlab:projectAccessToken:create` action, enabling the `expiresAt` option
@@ -49,6 +49,7 @@
"@gitbeaker/core": "^35.8.0",
"@gitbeaker/node": "^35.8.0",
"@gitbeaker/rest": "^39.25.0",
"luxon": "^3.0.0",
"yaml": "^2.0.0",
"zod": "^3.22.4"
},
@@ -17,7 +17,7 @@
import { InputError } from '@backstage/errors';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import { Gitlab } from '@gitbeaker/rest';
import { AccessTokenScopes, Gitlab } from '@gitbeaker/rest';
import { DateTime } from 'luxon';
import { z } from 'zod';
import { getToken } from '../util';
@@ -104,18 +104,17 @@ export const createGitlabProjectAccessTokenAction = (options: {
});
}
const mappedAccessLevel = Number(accessLevel.valueOf());
const response = await api.ProjectAccessTokens.create(
projectId,
name,
scopes as any,
scopes as AccessTokenScopes[],
{
expiresAt:
expiresAt || DateTime.now().plus({ days: 365 }).toISODate()!,
accessLevel: mappedAccessLevel,
accessLevel,
},
);
if (!response.token) {
throw new Error('Could not create project access token');
}
+1
View File
@@ -8385,6 +8385,7 @@ __metadata:
"@gitbeaker/node": ^35.8.0
"@gitbeaker/rest": ^39.25.0
jest-date-mock: ^1.0.8
luxon: ^3.0.0
yaml: ^2.0.0
zod: ^3.22.4
languageName: unknown