1
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2025-05-11 03:59:54 +02:00

Take global core.sshCommand into consideration

This commit is contained in:
Luca Niccoli 2023-01-04 17:08:43 +01:00
parent ac59398561
commit e978c3f43b
5 changed files with 103 additions and 11 deletions

14
dist/index.js vendored
View file

@ -7253,7 +7253,9 @@ class GitAuthHelper {
stateHelper.setSshKnownHostsPath(this.sshKnownHostsPath);
yield fs.promises.writeFile(this.sshKnownHostsPath, knownHosts);
// Configure GIT_SSH_COMMAND
const sshPath = yield io.which('ssh', true);
const sshPath = (yield this.git.configExists(SSH_COMMAND_KEY, true))
? yield this.git.configGet(SSH_COMMAND_KEY, true)
: yield io.which('ssh', true);
this.sshCommand = `"${sshPath}" -i "$RUNNER_TEMP/${path.basename(this.sshKeyPath)}"`;
if (this.settings.sshStrict) {
this.sshCommand += ' -o StrictHostKeyChecking=yes -o CheckHostIP=no';
@ -7533,6 +7535,16 @@ class GitCommandManager {
return output.exitCode === 0;
});
}
configGet(configKey, globalConfig) {
return __awaiter(this, void 0, void 0, function* () {
const output = yield this.execGit([
'config',
globalConfig ? '--global' : '--local',
configKey
]);
return output.stdout.trim();
});
}
fetch(refSpec, fetchDepth) {
return __awaiter(this, void 0, void 0, function* () {
const args = ['-c', 'protocol.version=2', 'fetch'];