fix(scaffolder-backend): use the right key when initializing a Gitlab client

Signed-off-by: djamaile <rdjamaile@gmail.com>
This commit is contained in:
djamaile
2022-02-03 22:14:29 +01:00
parent d5b6653839
commit 2bd5f24043
3 changed files with 9 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
fix for the gitlab:publish action to use the `oauthToken` key when creating a Gilab client. This only happens if ctx.input.token is provided else the key `token` will be used.
@@ -112,10 +112,11 @@ export function createPublishGitlabAction(options: {
}
const token = ctx.input.token || integrationConfig.config.token!;
const tokenType = ctx.input.token ? 'oauthToken' : 'token';
const client = new Gitlab({
host: integrationConfig.config.baseUrl,
token,
[tokenType]: token,
});
let { id: targetNamespace } = (await client.Namespaces.show(owner)) as {
@@ -118,10 +118,11 @@ export const createPublishGitlabMergeRequestAction = (options: {
}
const token = ctx.input.token ?? integrationConfig.config.token!;
const tokenType = ctx.input.token ? 'oauthToken' : 'token';
const api = new Gitlab({
host: integrationConfig.config.baseUrl,
token,
[tokenType]: token,
});
const fileRoot = ctx.workspacePath;