File tree 2 files changed +20
-6
lines changed
2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -121,9 +121,6 @@ const fs = __webpack_require__(747);
121
121
const os = __webpack_require__ ( 87 ) ;
122
122
123
123
try {
124
-
125
- const home = os . homedir ( ) ;
126
- const homeSsh = home + '/.ssh' ;
127
124
const privateKey = core . getInput ( 'ssh-private-key' ) ;
128
125
129
126
if ( ! privateKey ) {
@@ -132,11 +129,21 @@ try {
132
129
return ;
133
130
}
134
131
132
+ var home ;
133
+
135
134
if ( process . env [ 'OS' ] == 'Windows_NT' ) {
136
135
console . log ( 'Preparing ssh-agent service on Windows' ) ;
137
136
child_process . execSync ( 'sc config ssh-agent start=demand' , { stdio : 'inherit' } ) ;
137
+
138
+ home = os . homedir ( ) ;
139
+ } else {
140
+ // Use getent() system call, since this is what ssh does; makes a difference in Docker-based
141
+ // Action runs, where $HOME is different from the pwent
142
+ var { homedir : home } = os . userInfo ( ) ;
138
143
}
139
144
145
+ const homeSsh = home + '/.ssh' ;
146
+
140
147
console . log ( `Adding GitHub.com keys to ${ homeSsh } /known_hosts` ) ;
141
148
fs . mkdirSync ( homeSsh , { recursive : true } ) ;
142
149
fs . appendFileSync ( `${ homeSsh } /known_hosts` , '\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==\n' ) ;
Original file line number Diff line number Diff line change @@ -4,9 +4,6 @@ const fs = require('fs');
4
4
const os = require ( 'os' ) ;
5
5
6
6
try {
7
-
8
- const home = os . homedir ( ) ;
9
- const homeSsh = home + '/.ssh' ;
10
7
const privateKey = core . getInput ( 'ssh-private-key' ) ;
11
8
12
9
if ( ! privateKey ) {
@@ -15,11 +12,21 @@ try {
15
12
return ;
16
13
}
17
14
15
+ var home ;
16
+
18
17
if ( process . env [ 'OS' ] == 'Windows_NT' ) {
19
18
console . log ( 'Preparing ssh-agent service on Windows' ) ;
20
19
child_process . execSync ( 'sc config ssh-agent start=demand' , { stdio : 'inherit' } ) ;
20
+
21
+ home = os . homedir ( ) ;
22
+ } else {
23
+ // Use getent() system call, since this is what ssh does; makes a difference in Docker-based
24
+ // Action runs, where $HOME is different from the pwent
25
+ var { homedir : home } = os . userInfo ( ) ;
21
26
}
22
27
28
+ const homeSsh = home + '/.ssh' ;
29
+
23
30
console . log ( `Adding GitHub.com keys to ${ homeSsh } /known_hosts` ) ;
24
31
fs . mkdirSync ( homeSsh , { recursive : true } ) ;
25
32
fs . appendFileSync ( `${ homeSsh } /known_hosts` , '\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==\n' ) ;
You can’t perform that action at this time.
0 commit comments