-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
37 lines (33 loc) · 959 Bytes
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
name: Setup SSH
description: Setup the SSH agent and known hosts
branding:
icon: command
color: white
inputs:
host:
description: Hostname of the SSH server. Multiple hosts can be provided as a multiline string.
required: false
private-key:
description: PEM-encoded SSH private key for pulling the Shipyard registry index. Multiple keys can be provided as a multiline string.
required: true
runs:
using: composite
steps:
- uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ inputs.private-key }}
- name: Ensure .ssh/known_hosts exists
shell: bash
if: inputs.host
run: |
mkdir -p ~/.ssh
touch ~/.ssh/known_hosts
- name: Add host key(s) to .ssh/known_hosts
shell: bash
if: inputs.host
run: |
IFS=$'\n' hosts=(${{ inputs.host }})
for host in "${hosts[@]}"; do
ssh-keyscan $host >> ~/.ssh/known_hosts
done