Use full serviceUrl instead of origin

This commit is contained in:
2026-03-16 18:05:42 +01:00
parent de0fac2e45
commit 33927cc7e9
3 changed files with 7 additions and 7 deletions

8
dist/index.js vendored
View File

@@ -167,13 +167,13 @@ class GitAuthHelper {
this.settings = gitSourceSettings || {};
// Token auth header
const serverUrl = urlHelper.getServerUrl(this.settings.githubServerUrl);
this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
this.tokenConfigKey = `http.${serverUrl.origin}${serverUrl.pathname}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
core.setSecret(basicCredential);
this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`;
this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`;
// Instead of SSH URL
this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf`; // "origin" is SCHEME://HOSTNAME[:PORT]
this.insteadOfKey = `url.${serverUrl.origin}${serverUrl.pathname}/.insteadOf`; // "origin" is SCHEME://HOSTNAME[:PORT]
this.insteadOfValues.push(`git@${serverUrl.hostname}:`);
if (this.settings.workflowOrganizationId) {
this.insteadOfValues.push(`org-${this.settings.workflowOrganizationId}@github.com:`);
@@ -2731,7 +2731,7 @@ function getFetchUrl(settings) {
return `${user}@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
}
// "origin" is SCHEME://HOSTNAME[:PORT]
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
return `${serviceUrl.origin}${serviceUrl.pathname}/${encodedOwner}/${encodedName}`;
}
function getServerUrl(url) {
let resolvedUrl = process.env['GITHUB_SERVER_URL'] || 'https://github.com';
@@ -38511,4 +38511,4 @@ module.exports = parseParams
/******/ module.exports = __webpack_exports__;
/******/
/******/ })()
;
;