From cbde67df6cb148baae79c5a5e8a2979691246c8b Mon Sep 17 00:00:00 2001 From: Kipras Melnikovas Date: Sun, 28 Nov 2021 13:51:40 +0200 Subject: [PATCH 1/3] github action runners can be self-hosted. i am running one inside my server. turns out, the github action cannot just assume that it's the only one who's using the server's infrastructure. this should help w/ the ssh stuff. fyi, i am not sure 100% if this fixes it: i tried running the commands here and it helped, but not sure if it i'll be the case when the action does so, but should be good. for _not_ overriding the .ssh/config, for _not_ spamming the .ssh/known_hosts file, i'll consider creating separate PRs. Signed-off-by: Kipras Melnikovas --- src/set-tokens.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/set-tokens.ts b/src/set-tokens.ts index 277e7fc0f..f4d63f5c9 100644 --- a/src/set-tokens.ts +++ b/src/set-tokens.ts @@ -59,8 +59,8 @@ Watch https://github.com/peaceiris/actions-gh-pages/issues/87 await exec.exec('sc', ['config', 'ssh-agent', 'start=auto']); await exec.exec('sc', ['start', 'ssh-agent']); } - await cpexec('ssh-agent', ['-a', '/tmp/ssh-auth.sock']); - core.exportVariable('SSH_AUTH_SOCK', '/tmp/ssh-auth.sock'); + await cpexec('ssh-agent', ['-a', '/tmp/ssh-auth.actions-gh-pages.sock']); + core.exportVariable('SSH_AUTH_SOCK', '/tmp/ssh-auth.actions-gh-pages.sock'); await exec.exec('ssh-add', [idRSA]); return `git@${getServerUrl().host}:${publishRepo}.git`; From 26852ea92c125eecd304fa261bba1d396b10c881 Mon Sep 17 00:00:00 2001 From: Kipras Melnikovas Date: Sun, 28 Nov 2021 14:35:27 +0200 Subject: [PATCH 2/3] fix: use a randomized name for the ssh socket Signed-off-by: Kipras Melnikovas --- src/set-tokens.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/set-tokens.ts b/src/set-tokens.ts index f4d63f5c9..8e9b8f4f0 100644 --- a/src/set-tokens.ts +++ b/src/set-tokens.ts @@ -59,8 +59,9 @@ Watch https://github.com/peaceiris/actions-gh-pages/issues/87 await exec.exec('sc', ['config', 'ssh-agent', 'start=auto']); await exec.exec('sc', ['start', 'ssh-agent']); } - await cpexec('ssh-agent', ['-a', '/tmp/ssh-auth.actions-gh-pages.sock']); - core.exportVariable('SSH_AUTH_SOCK', '/tmp/ssh-auth.actions-gh-pages.sock'); + const socketPath = `/tmp/ssh-auth.actions-gh-pages.${Math.random().toString().slice(2)}.sock`; + await cpexec('ssh-agent', ['-a', socketPath]); + core.exportVariable('SSH_AUTH_SOCK', socketPath); await exec.exec('ssh-add', [idRSA]); return `git@${getServerUrl().host}:${publishRepo}.git`; From cd1d52d833cf02ad50959fb20da3ca9a32f68d32 Mon Sep 17 00:00:00 2001 From: Kipras Melnikovas Date: Sun, 28 Nov 2021 14:37:17 +0200 Subject: [PATCH 3/3] chore: add log.info for socket's path Signed-off-by: Kipras Melnikovas --- src/set-tokens.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/set-tokens.ts b/src/set-tokens.ts index 8e9b8f4f0..af6766832 100644 --- a/src/set-tokens.ts +++ b/src/set-tokens.ts @@ -60,6 +60,7 @@ Watch https://github.com/peaceiris/actions-gh-pages/issues/87 await exec.exec('sc', ['start', 'ssh-agent']); } const socketPath = `/tmp/ssh-auth.actions-gh-pages.${Math.random().toString().slice(2)}.sock`; + core.info(`[INFO] acquiring socket with path: ${socketPath}`); await cpexec('ssh-agent', ['-a', socketPath]); core.exportVariable('SSH_AUTH_SOCK', socketPath); await exec.exec('ssh-add', [idRSA]);