From 9683b6d018a2c575dac729e7351d874cc4076013 Mon Sep 17 00:00:00 2001 From: Camilo Celis Guzman Date: Fri, 2 Sep 2022 14:59:27 +0900 Subject: [PATCH] default to true and remove need to monkeypatch getBoolean --- action.yml | 3 +++ index.js | 18 +----------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/action.yml b/action.yml index 16aaba6..85e8943 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,9 @@ inputs: required: true ssh-auth-sock: description: 'Where to place the SSH Agent auth socket' + log-public-key: + description: 'Whether or not to log public key fingerprints' + default: true runs: using: 'node12' main: 'dist/index.js' diff --git a/index.js b/index.js index 91d0514..fdef02d 100644 --- a/index.js +++ b/index.js @@ -4,25 +4,9 @@ const fs = require('fs'); const crypto = require('crypto'); const { home, sshAgent, sshAdd } = require('./paths.js'); -// FIXME: slightly modified version of never version of core.getBooleanInput -// as that doesn't respect required:false -core.getBooleanInput = function getBooleanInput(name, options) { - const trueValue = ['true', 'True', 'TRUE'] - const falseValue = ['false', 'False', 'FALSE'] - const val = core.getInput(name, options) - if (!val) return false // replace with default InputOption - if (trueValue.includes(val)) return true - if (falseValue.includes(val)) return false - throw new TypeError( - `Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + - `Support boolean input list: \`true | True | TRUE | false | False | FALSE\`` - ) -} - - try { const privateKey = core.getInput('ssh-private-key'); - const logPublicKey = core.getBooleanInput('log-public-key', {required: false}); + const logPublicKey = core.getBooleanInput('log-public-key'); 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.");