From d12c16f961d55593b66dc09f53e98d4ed2a8465c Mon Sep 17 00:00:00 2001 From: Thomas Ali <55087837+thomasali@users.noreply.github.com> Date: Tue, 10 Jan 2023 13:47:26 +0000 Subject: [PATCH] Add self-hosted option to action (#52) + This skips over the SSH configuration part of the action. + This is because self-hosted runners would typically have SSH already running causing ssh-agent command to throw an error (process already exists/port in use) --- README.md | 4 ++++ action.yaml | 5 +++++ index.js | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index c315404..26f0230 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ # Required. dep: deploy + # Option to skip over the SSH setup/configuration + # Self hosted runners don't need the SSH configuration or the SSH agent to be started + self-hosted: false + # Private key for connecting to remote hosts. To generate private key: # `ssh-keygen -o -t rsa -C 'action@deployer.org'`. # Optional. diff --git a/action.yaml b/action.yaml index 4b04cc0..fe581bb 100644 --- a/action.yaml +++ b/action.yaml @@ -8,6 +8,11 @@ inputs: required: true description: The command. + self-hosted: + required: false + default: 'false' + description: Whether the action is running on a self-hosted runner. + private-key: required: false default: '' diff --git a/index.js b/index.js index d75e719..a3f24fb 100644 --- a/index.js +++ b/index.js @@ -12,6 +12,10 @@ void async function main() { }() async function ssh() { + if (core.getBooleanInput('self-hosted')) { + return; + } + let sshHomeDir = `${process.env['HOME']}/.ssh` if (!fs.existsSync(sshHomeDir)) {