Skip to content

Commit

Permalink
fix(scaffolder-backend): use the right key when initializing a Gitlab…
Browse files Browse the repository at this point in the history
… client

Signed-off-by: djamaile <rdjamaile@gmail.com>
  • Loading branch information
djamaile committed Feb 3, 2022
1 parent d5b6653 commit 2bd5f24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/seven-teachers-arrive.md
@@ -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.
Expand Up @@ -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 {
Expand Down
Expand Up @@ -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;
Expand Down

0 comments on commit 2bd5f24

Please sign in to comment.