Acknowledge custom command inputs in cleanup.js (#235)

Refactored version of https://github.com/webfactory/ssh-agent/pull/183.

Fixes: https://github.com/webfactory/ssh-agent/issues/208
This commit is contained in:
Jano Paetzold 2025-01-08 17:59:51 +01:00 committed by GitHub
parent b504c19775
commit e3f1a8e046
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 87 additions and 95 deletions

View file

@ -1,6 +1,7 @@
const os = require('os');
const core = require('@actions/core');
module.exports = (process.env['OS'] != 'Windows_NT') ? {
const defaults = (process.env['OS'] != 'Windows_NT') ? {
// 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
homePath: os.userInfo().homedir,
@ -14,3 +15,14 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? {
sshAddCmdDefault: 'c://progra~1//git//usr//bin//ssh-add.exe',
gitCmdDefault: 'c://progra~1//git//bin//git.exe'
};
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,
};