Skip to content

Instantly share code, notes, and snippets.

@mpdude
Last active August 25, 2023 13:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpdude/9cf8181a4adebda0c30b555b41692b18 to your computer and use it in GitHub Desktop.
Save mpdude/9cf8181a4adebda0c30b555b41692b18 to your computer and use it in GitHub Desktop.
Setup a SSH deploy key so that workflow steps can fetch dependencies from private GitHub repos
# .github/workflows/my-workflow.yml
# ... other config here
jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Setup SSH Keys and known_hosts
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}"
- name: Some task that fetches dependencies
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: ./fetch-deps.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment