From 0673b3776febd7d9b0230b3b63cc8086d90d3f64 Mon Sep 17 00:00:00 2001 From: shimataro Date: Mon, 8 Mar 2021 17:09:37 +0900 Subject: [PATCH] test no_known_hosts parameter --- .github/workflows/verify-on-ubuntu.yml | 24 ++++++++++++++++++++++++ action.yml | 4 ++++ lib/index.js | 3 +++ src/main.ts | 4 ++++ 4 files changed, 35 insertions(+) diff --git a/.github/workflows/verify-on-ubuntu.yml b/.github/workflows/verify-on-ubuntu.yml index 7117eaf..5839b0b 100644 --- a/.github/workflows/verify-on-ubuntu.yml +++ b/.github/workflows/verify-on-ubuntu.yml @@ -257,3 +257,27 @@ jobs: run: ls -l ~/.ssh - name: git clone through SSH run: git clone git@github.com:shimataro/ssh-key-action.git tmp + + no_known_hosts: + name: no known_hosts file + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + - ubuntu-20.04 + steps: + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Install SSH key + uses: ./. + with: + key: ${{ secrets.SSH_KEY_PEM }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} + no_known_hosts: true + - name: print created files + run: ls -l ~/.ssh + - name: git clone through SSH + run: git clone git@github.com:shimataro/ssh-key-action.git tmp diff --git a/action.yml b/action.yml index 6fab2b1..6608df2 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,10 @@ inputs: description: "replace / ignore / fail" required: false default: "fail" + no_known_hosts: + description: "enables not providing known_hosts file" + required: false + default: "0" runs: using: "node12" main: "lib/index.js" diff --git a/lib/index.js b/lib/index.js index 8817986..b7f6a6f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -437,6 +437,9 @@ function main() { }); const config = core.getInput("config"); const ifKeyExists = core.getInput("if_key_exists"); + // test + const noKnownHosts = core.getInput("no_known_hosts"); + console.log(noKnownHosts); // create ".ssh" directory const home = getHomeDirectory(); const dirName = path_1.default.resolve(home, ".ssh"); diff --git a/src/main.ts b/src/main.ts index 0764350..429be53 100644 --- a/src/main.ts +++ b/src/main.ts @@ -28,6 +28,10 @@ function main(): void const config = core.getInput("config"); const ifKeyExists = core.getInput("if_key_exists"); + // test + const noKnownHosts = core.getInput("no_known_hosts"); + console.log(noKnownHosts); + // create ".ssh" directory const home = getHomeDirectory(); const dirName = path.resolve(home, ".ssh");