Skip to content

Commit b3b3216

Browse files
committed
Fix home dir detection
1 parent e7e7ec8 commit b3b3216

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

dist/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const fs = __webpack_require__(747);
6060
try {
6161
const os = process.env['OS'];
6262
const privateKey = core.getInput('ssh-private-key').trim();
63+
var home, homeSsh;
6364

6465
if (!privateKey) {
6566
core.setFailed("The ssh-private-key argument is empty. Maybe the secret has not been configured, or you are using a wrong secret name in your workflow file.");
@@ -71,12 +72,12 @@ try {
7172
console.log('Preparing ssh-agent service on Windows');
7273
child_process.execSync('sc config ssh-agent start=demand', { stdio: 'inherit' });
7374

74-
const home = process.env['HOMEDRIVE'] + process.env['HOMEPATH'];
75+
home = process.env['HOMEDRIVE'] + process.env['HOMEPATH'];
7576
} else {
76-
const home = process.env['HOME'];
77+
home = process.env['HOME'];
7778
}
7879

79-
const homeSsh = home + '/.ssh';
80+
homeSsh = home + '/.ssh';
8081

8182
console.log(`Adding GitHub.com keys to ${homeSsh}/known_hosts`);
8283
fs.mkdirSync(homeSsh, { recursive: true});

index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const fs = require('fs');
55
try {
66
const os = process.env['OS'];
77
const privateKey = core.getInput('ssh-private-key').trim();
8+
var home, homeSsh;
89

910
if (!privateKey) {
1011
core.setFailed("The ssh-private-key argument is empty. Maybe the secret has not been configured, or you are using a wrong secret name in your workflow file.");
@@ -16,12 +17,12 @@ try {
1617
console.log('Preparing ssh-agent service on Windows');
1718
child_process.execSync('sc config ssh-agent start=demand', { stdio: 'inherit' });
1819

19-
const home = process.env['HOMEDRIVE'] + process.env['HOMEPATH'];
20+
home = process.env['HOMEDRIVE'] + process.env['HOMEPATH'];
2021
} else {
21-
const home = process.env['HOME'];
22+
home = process.env['HOME'];
2223
}
2324

24-
const homeSsh = home + '/.ssh';
25+
homeSsh = home + '/.ssh';
2526

2627
console.log(`Adding GitHub.com keys to ${homeSsh}/known_hosts`);
2728
fs.mkdirSync(homeSsh, { recursive: true});

0 commit comments

Comments
 (0)