Merge pull request #26687 from matthewbednarski/patch-2

Update bitbucketServerPullRequest.ts - protocol from apiBaseUrl
This commit is contained in:
Ben Lambert
2024-10-01 10:51:22 +02:00
committed by GitHub
2 changed files with 13 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend-module-bitbucket-server': patch
---
Use protocol from Bitbucket Server apiBaseUrl config parameter instead of hard-coded https
@@ -237,6 +237,10 @@ const getDefaultBranch = async (opts: {
}
return defaultBranch;
};
const isApiBaseUrlHttps = (apiBaseUrl: string): boolean => {
const url = new URL(apiBaseUrl);
return url.protocol === 'https:';
};
/**
* Creates a BitbucketServer Pull Request action.
* @public
@@ -401,7 +405,10 @@ export function createPublishBitbucketServerPullRequestAction(options: {
startPoint: latestCommit,
});
const remoteUrl = `https://${host}/scm/${project}/${repo}.git`;
const isHttps: boolean = isApiBaseUrlHttps(apiBaseUrl);
const remoteUrl = `${
isHttps ? 'https' : 'http'
}://${host}/scm/${project}/${repo}.git`;
const auth = authConfig.token
? {