Merge pull request #26687 from matthewbednarski/patch-2
Update bitbucketServerPullRequest.ts - protocol from apiBaseUrl
This commit is contained in:
@@ -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
|
||||
+8
-1
@@ -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
|
||||
? {
|
||||
|
||||
Reference in New Issue
Block a user