-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
31 lines (29 loc) · 1.06 KB
/
Copy pathaction.yml
File metadata and controls
31 lines (29 loc) · 1.06 KB
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
name: Setup SSH agent
description: "A composite action to setup and configure the SSH agent for connecting to a remote host."
author: Dr. Kibitz (@drkibitz)
inputs:
port:
description: "The port to connect to the SSH server (default: 22)."
required: false
default: "22"
username:
description: "The username for SSH authentication."
required: true
hostname:
description: "The hostname or IP address of the SSH server."
required: true
ssh-private-key:
description: "The SSH private key used to authenticate with the SSH server."
required: true
runs:
using: composite
steps:
- name: Setup SSH agent
run: |
mkdir -p ~/.ssh/ && touch ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-keyscan -p ${{ inputs.port }} ${{ inputs.hostname }} >> ~/.ssh/known_hosts 2>/dev/null
echo "${{ inputs.ssh-private-key }}" | ssh-add -
ssh -T -n -o BatchMode=yes -p ${{ inputs.port }} ${{ inputs.username }}@${{ inputs.hostname }}
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> "$GITHUB_ENV"
shell: bash