Add OAuth support for bitbucket publish action
Signed-off-by: Jake Smith <jakemgsmith@gmail.com>
This commit is contained in:
committed by
Fredrik Adelöw
parent
1956b3f398
commit
e3ba350ee3
@@ -25,6 +25,7 @@ import {
|
||||
|
||||
import { Config } from '@backstage/config';
|
||||
import { getAuthorizationHeader } from './helpers';
|
||||
import { getBitbucketCloudOAuthToken } from '@backstage/integration';
|
||||
import { examples } from './bitbucketCloud.examples';
|
||||
|
||||
const createRepository = async (opts: {
|
||||
@@ -249,6 +250,18 @@ export function createPublishBitbucketCloudAction(options: {
|
||||
username: 'x-token-auth',
|
||||
password: ctx.input.token,
|
||||
};
|
||||
} else if (
|
||||
integrationConfig.config.clientId &&
|
||||
integrationConfig.config.clientSecret
|
||||
) {
|
||||
const token = await getBitbucketCloudOAuthToken(
|
||||
integrationConfig.config.clientId,
|
||||
integrationConfig.config.clientSecret,
|
||||
);
|
||||
auth = {
|
||||
username: 'x-token-auth',
|
||||
password: token,
|
||||
};
|
||||
} else {
|
||||
if (
|
||||
!integrationConfig.config.username ||
|
||||
|
||||
Reference in New Issue
Block a user