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
@@ -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');
}