Skip to content

Commit d1b2e86

Browse files
committed
Add support for multiple host key scanning
1 parent b01edb2 commit d1b2e86

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

action.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ branding:
77

88
inputs:
99
host:
10-
description: Hostname of the SSH server
10+
description: Hostname of the SSH server. Multiple hosts can be provided as a multiline string.
1111
required: false
1212
private-key:
13-
description: PEM-encoded SSH private key for pulling the Shipyard registry index
13+
description: PEM-encoded SSH private key for pulling the Shipyard registry index. Multiple keys can be provided as a multiline string.
1414
required: true
1515

1616
runs:
@@ -20,10 +20,18 @@ runs:
2020
with:
2121
ssh-private-key: ${{ inputs.private-key }}
2222

23-
- name: Add host key to .ssh/known_hosts
23+
- name: Ensure .ssh/known_hosts exists
2424
shell: bash
2525
if: inputs.host
2626
run: |
2727
mkdir -p ~/.ssh
2828
touch ~/.ssh/known_hosts
29-
ssh-keyscan ${{ inputs.host }} >> ~/.ssh/known_hosts
29+
30+
- name: Add host key(s) to .ssh/known_hosts
31+
shell: bash
32+
if: inputs.host
33+
run: |
34+
IFS=$'\n' hosts=(${{ inputs.host }})
35+
for host in "${hosts[@]}"; do
36+
ssh-keyscan $host >> ~/.ssh/known_hosts
37+
done

0 commit comments

Comments
 (0)