mirror of
https://github.com/webfactory/ssh-agent.git
synced 2025-06-28 13:43:46 +00:00
Try to kill the ssh-agent upon action termination on Windows as well
This commit is contained in:
parent
384ccf693f
commit
d57d85f6f9
5 changed files with 82 additions and 42 deletions
18
index.js
18
index.js
|
@ -1,8 +1,8 @@
|
|||
const core = require('@actions/core');
|
||||
const child_process = require('child_process');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const crypto = require('crypto');
|
||||
const { home, sshAgent, sshAdd } = require('./paths.js');
|
||||
|
||||
try {
|
||||
const privateKey = core.getInput('ssh-private-key');
|
||||
|
@ -13,22 +13,6 @@ try {
|
|||
return;
|
||||
}
|
||||
|
||||
const { home, sshAgent, sshAdd } = (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
|
||||
home: os.userInfo().homedir,
|
||||
sshAgent: 'ssh-agent',
|
||||
sshAdd: 'ssh-add'
|
||||
|
||||
} : {
|
||||
|
||||
home: os.homedir(),
|
||||
sshAgent: 'c://progra~1//git//usr//bin//ssh-agent.exe',
|
||||
sshAdd: 'c://progra~1//git//usr//bin//ssh-add.exe'
|
||||
|
||||
};
|
||||
|
||||
const homeSsh = home + '/.ssh';
|
||||
|
||||
console.log(`Adding GitHub.com keys to ${homeSsh}/known_hosts`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue