webfactory/ssh-agent

Advised usage for docker integration

bendavies opened this issue · 2 comments

Hey there!

Thanks for the great action.
Do you have any opinion on the best way to use this action with docker volumes?

I'm doing this but would like to know if there is a better way?

on: push

name: "Test"

jobs:
  build:
    name: "Test"

    runs-on: ubuntu-latest

    steps:

      - name: "Install SSH Key"
        uses: webfactory/ssh-agent@v0.1.1
        with:
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

      - name: "Test"
        run: |
          docker run --rm \
            -v $SSH_AUTH_SOCK:/ssh-agent -v ~/.ssh/known_hosts:/root/.ssh/known_hosts -e SSH_AUTH_SOCK=/ssh-agent \
            image \
            bash -c "ssh-add -l && ssh -T git@github.com"

Thanks!

Looks good to me and is the way I’d do it as well.

👍