@@ -1266,6 +1266,46 @@ const windowsRelease = release => {
1266
1266
module.exports = windowsRelease;
1267
1267
1268
1268
1269
+ /***/ }),
1270
+
1271
+ /***/ 81:
1272
+ /***/ (function(__unusedmodule, exports, __webpack_require__) {
1273
+
1274
+ "use strict";
1275
+
1276
+ var __importStar = (this && this.__importStar) || function (mod) {
1277
+ if (mod && mod.__esModule) return mod;
1278
+ var result = {};
1279
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
1280
+ result["default"] = mod;
1281
+ return result;
1282
+ };
1283
+ Object.defineProperty(exports, "__esModule", { value: true });
1284
+ const assert = __importStar(__webpack_require__(357));
1285
+ const url_1 = __webpack_require__(835);
1286
+ function getApiUrl() {
1287
+ return process.env['GITHUB_API_URL'] || 'https://api.github.com';
1288
+ }
1289
+ exports.getApiUrl = getApiUrl;
1290
+ function getFetchUrl(settings) {
1291
+ assert.ok(settings.repositoryOwner, 'settings.repositoryOwner must be defined');
1292
+ assert.ok(settings.repositoryName, 'settings.repositoryName must be defined');
1293
+ const serviceUrl = getServerUrl();
1294
+ const encodedOwner = encodeURIComponent(settings.repositoryOwner);
1295
+ const encodedName = encodeURIComponent(settings.repositoryName);
1296
+ if (settings.sshKey) {
1297
+ return `git@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
1298
+ }
1299
+ // "origin" is SCHEME://HOSTNAME[:PORT]
1300
+ return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
1301
+ }
1302
+ exports.getFetchUrl = getFetchUrl;
1303
+ function getServerUrl() {
1304
+ return new url_1.URL(process.env['GITHUB_URL'] || 'https://github.com');
1305
+ }
1306
+ exports.getServerUrl = getServerUrl;
1307
+
1308
+
1269
1309
/***/ }),
1270
1310
1271
1311
/***/ 87:
@@ -5109,30 +5149,32 @@ const os = __importStar(__webpack_require__(87));
5109
5149
const path = __importStar(__webpack_require__(622));
5110
5150
const regexpHelper = __importStar(__webpack_require__(528));
5111
5151
const stateHelper = __importStar(__webpack_require__(153));
5152
+ const urlHelper = __importStar(__webpack_require__(81));
5112
5153
const v4_1 = __importDefault(__webpack_require__(826));
5113
5154
const IS_WINDOWS = process.platform === 'win32';
5114
- const HOSTNAME = 'github.com';
5115
5155
const SSH_COMMAND_KEY = 'core.sshCommand';
5116
5156
function createAuthHelper(git, settings) {
5117
5157
return new GitAuthHelper(git, settings);
5118
5158
}
5119
5159
exports.createAuthHelper = createAuthHelper;
5120
5160
class GitAuthHelper {
5121
5161
constructor(gitCommandManager, gitSourceSettings) {
5122
- this.tokenConfigKey = `http.https://${HOSTNAME}/.extraheader`;
5123
- this.insteadOfKey = `url.https://${HOSTNAME}/.insteadOf`;
5124
- this.insteadOfValue = `git@${HOSTNAME}:`;
5125
5162
this.sshCommand = '';
5126
5163
this.sshKeyPath = '';
5127
5164
this.sshKnownHostsPath = '';
5128
5165
this.temporaryHomePath = '';
5129
5166
this.git = gitCommandManager;
5130
5167
this.settings = gitSourceSettings || {};
5131
5168
// Token auth header
5169
+ const serverUrl = urlHelper.getServerUrl();
5170
+ this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
5132
5171
const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
5133
5172
core.setSecret(basicCredential);
5134
5173
this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`;
5135
5174
this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`;
5175
+ // Instead of SSH URL
5176
+ this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf`; // "origin" is SCHEME://HOSTNAME[:PORT]
5177
+ this.insteadOfValue = `git@${serverUrl.hostname}:`;
5136
5178
}
5137
5179
configureAuth() {
5138
5180
return __awaiter(this, void 0, void 0, function* () {
@@ -5797,14 +5839,12 @@ const io = __importStar(__webpack_require__(1));
5797
5839
const path = __importStar(__webpack_require__(622));
5798
5840
const refHelper = __importStar(__webpack_require__(227));
5799
5841
const stateHelper = __importStar(__webpack_require__(153));
5800
- const hostname = 'github.com' ;
5842
+ const urlHelper = __importStar(__webpack_require__(81)) ;
5801
5843
function getSource(settings) {
5802
5844
return __awaiter(this, void 0, void 0, function* () {
5803
5845
// Repository URL
5804
5846
core.info(`Syncing repository: ${settings.repositoryOwner}/${settings.repositoryName}`);
5805
- const repositoryUrl = settings.sshKey
5806
- ? `git@${hostname}:${encodeURIComponent(settings.repositoryOwner)}/${encodeURIComponent(settings.repositoryName)}.git`
5807
- : `https://${hostname}/${encodeURIComponent(settings.repositoryOwner)}/${encodeURIComponent(settings.repositoryName)}`;
5847
+ const repositoryUrl = urlHelper.getFetchUrl(settings);
5808
5848
// Remove conflicting file path
5809
5849
if (fsHelper.fileExistsSync(settings.repositoryPath)) {
5810
5850
yield io.rmRF(settings.repositoryPath);
@@ -9159,6 +9199,7 @@ const io = __importStar(__webpack_require__(1));
9159
9199
const path = __importStar(__webpack_require__(622));
9160
9200
const retryHelper = __importStar(__webpack_require__(587));
9161
9201
const toolCache = __importStar(__webpack_require__(533));
9202
+ const urlHelper = __importStar(__webpack_require__(81));
9162
9203
const v4_1 = __importDefault(__webpack_require__(826));
9163
9204
const IS_WINDOWS = process.platform === 'win32';
9164
9205
function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath) {
@@ -9209,7 +9250,7 @@ function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath)
9209
9250
exports.downloadRepository = downloadRepository;
9210
9251
function downloadArchive(authToken, owner, repo, ref, commit) {
9211
9252
return __awaiter(this, void 0, void 0, function* () {
9212
- const octokit = new github.GitHub(authToken);
9253
+ const octokit = new github.GitHub(authToken, { baseUrl: urlHelper.getApiUrl() } );
9213
9254
const params = {
9214
9255
owner: owner,
9215
9256
repo: repo,
0 commit comments