fix schema definition for projectid and deploy token parsing
Signed-off-by: Dominik Pfaffenbauer <dominik@pfaffenbauer.at>
This commit is contained in:
@@ -48,7 +48,7 @@ export const createGitlabProjectAccessToken = (options: {
|
||||
},
|
||||
projectId: {
|
||||
title: 'Project ID',
|
||||
type: 'string | number',
|
||||
type: ['string', 'number'],
|
||||
},
|
||||
name: {
|
||||
title: 'Deploy Token Name',
|
||||
|
||||
@@ -19,6 +19,7 @@ import { Gitlab } from '@gitbeaker/node';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { DeployTokenScope } from '@gitbeaker/core/dist/types/templates/ResourceDeployTokens';
|
||||
import { getToken } from '../util';
|
||||
import { InputError } from '@backstage/errors';
|
||||
|
||||
/**
|
||||
* Creates a `gitlab:create-project-deploy-token` Scaffolder action.
|
||||
@@ -50,7 +51,7 @@ export const createGitlabProjectDeployToken = (options: {
|
||||
},
|
||||
projectId: {
|
||||
title: 'Project ID',
|
||||
type: 'string | number',
|
||||
type: ['string', 'number'],
|
||||
},
|
||||
name: {
|
||||
title: 'Deploy Token Name',
|
||||
@@ -108,10 +109,11 @@ export const createGitlabProjectDeployToken = (options: {
|
||||
},
|
||||
);
|
||||
|
||||
const string = JSON.stringify(deployToken);
|
||||
const result = JSON.parse(string);
|
||||
if (!deployToken.hasOwnProperty('token')) {
|
||||
throw new InputError(`No deploy_token given from gitlab instance`);
|
||||
}
|
||||
|
||||
ctx.output('deploy_token', result.token);
|
||||
ctx.output('deploy_token', deployToken.token as string);
|
||||
ctx.output('user', deployToken.username);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -61,6 +61,10 @@ export const createGitlabProjectVariable = (options: {
|
||||
title: 'Repository Location',
|
||||
type: 'string',
|
||||
},
|
||||
projectId: {
|
||||
title: 'Project ID',
|
||||
type: ['string', 'number'],
|
||||
},
|
||||
key: {
|
||||
title:
|
||||
'The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed',
|
||||
|
||||
Reference in New Issue
Block a user