2021-03-10 08:19:17 +01:00
|
|
|
const os = require('os');
|
2025-01-08 17:59:51 +01:00
|
|
|
const core = require('@actions/core');
|
2021-03-10 08:19:17 +01:00
|
|
|
|
2025-01-08 17:59:51 +01:00
|
|
|
const defaults = (process.env['OS'] != 'Windows_NT') ? {
|
2021-03-10 08:19:17 +01:00
|
|
|
// Use getent() system call, since this is what ssh does; makes a difference in Docker-based
|
|
|
|
// Action runs, where $HOME is different from the pwent
|
2022-10-19 13:27:50 +02:00
|
|
|
homePath: os.userInfo().homedir,
|
2023-01-27 12:09:18 -05:00
|
|
|
sshAgentCmdDefault: 'ssh-agent',
|
|
|
|
sshAddCmdDefault: 'ssh-add',
|
|
|
|
gitCmdDefault: 'git'
|
2021-03-10 08:19:17 +01:00
|
|
|
} : {
|
2022-10-19 13:27:50 +02:00
|
|
|
// Assuming GitHub hosted `windows-*` runners for now
|
|
|
|
homePath: os.homedir(),
|
2023-01-27 12:09:18 -05:00
|
|
|
sshAgentCmdDefault: 'c://progra~1//git//usr//bin//ssh-agent.exe',
|
|
|
|
sshAddCmdDefault: 'c://progra~1//git//usr//bin//ssh-add.exe',
|
|
|
|
gitCmdDefault: 'c://progra~1//git//bin//git.exe'
|
2021-03-10 08:19:17 +01:00
|
|
|
};
|
2025-01-08 17:59:51 +01:00
|
|
|
|
|
|
|
const sshAgentCmdInput = core.getInput('ssh-agent-cmd');
|
|
|
|
const sshAddCmdInput = core.getInput('ssh-add-cmd');
|
|
|
|
const gitCmdInput = core.getInput('git-cmd');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
homePath: defaults.homePath,
|
|
|
|
sshAgentCmd: sshAgentCmdInput !== '' ? sshAgentCmdInput : defaults.sshAgentCmdDefault,
|
|
|
|
sshAddCmd: sshAddCmdInput !== '' ? sshAddCmdInput : defaults.sshAddCmdDefault,
|
|
|
|
gitCmd: gitCmdInput !== '' ? gitCmdInput : defaults.gitCmdDefault,
|
|
|
|
};
|