Skip to content

Commit

Permalink
Add reusable workflow for setting up SSH agent
Browse files Browse the repository at this point in the history
  • Loading branch information
p3k committed Jun 1, 2024
1 parent 0e8ce1d commit f61a57c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ssh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Set up SSH agent

on:
workflow_call:
inputs:
config:
required: true
type: string
known-hosts:
required: true
type: string
secrets:
key:
required: true

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.key }}"
mkdir -p ~/.ssh
echo '${{ inputs.config }}' > ~/.ssh/config
echo '${{ inputs.known-hosts }}' > ~/.ssh/known_hosts

0 comments on commit f61a57c

Please sign in to comment.