Add reusable workflow for setting up SSH agent

This commit is contained in:
Tobi Schäfer 2024-06-01 15:17:34 +02:00
parent 0e8ce1d7a7
commit 8af6aeceb6
Signed by: tobi
GPG key ID: 91FAE6FE2EBAC4C8
2 changed files with 35 additions and 11 deletions

27
.github/workflows/ssh.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Set up SSH agent
on:
workflow_call:
inputs:
config:
required: true
type: string
known-hosts:
required: true
type: string
env:
SSH_AUTH_SOCK: /tmp/ssh-agent.sock
jobs:
ssh-agent:
runs-on: ubuntu-latest
steps:
- name: Set up SSH agent
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< '${{ secrets.SSH_PRIVATE_KEY }}'
mkdir -p ~/.ssh
echo '${{ inputs.config }}' > ~/.ssh/config
echo '${{ inputs.known-hosts }}' > ~/.ssh/known_hosts