diff --git a/action.yml b/action.yml index 16aaba6..838515a 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,10 @@ inputs: required: true ssh-auth-sock: description: 'Where to place the SSH Agent auth socket' + dont-log-public-key: + description: 'Whether or not to log public key fingerprints' + required: false + default: false runs: using: 'node12' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index fe01c67..1dbdaf9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -326,6 +326,7 @@ const { home, sshAgent, sshAdd } = __webpack_require__(972); try { const privateKey = core.getInput('ssh-private-key'); + const dontLogPublicKey = core.getBooleanInput('dont-log-public-key', {default: false}); if (!privateKey) { 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."); @@ -374,8 +375,9 @@ try { const parts = key.match(/\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+)/i); if (!parts) { - console.log(`Comment for (public) key '${key}' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.`); - + if (!dontLogPublicKey) { + console.log(`Comment for (public) key '${key}' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.`); + } return; } diff --git a/index.js b/index.js index e08d46f..c8ad8aa 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,7 @@ const { home, sshAgent, sshAdd } = require('./paths.js'); try { const privateKey = core.getInput('ssh-private-key'); + const dontLogPublicKey = core.getBooleanInput('dont-log-public-key', {default: false}); if (!privateKey) { 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."); @@ -54,8 +55,9 @@ try { const parts = key.match(/\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+)/i); if (!parts) { - console.log(`Comment for (public) key '${key}' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.`); - + if (!dontLogPublicKey) { + console.log(`Comment for (public) key '${key}' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.`); + } return; }