This action
- starts the
ssh-agent, - exports the
SSH_AUTH_SOCKenvironment variable, - loads a private SSH key into the agent and
- configures
known_hostsfor GitHub.com.
Why?
When running a GitHub Action workflow to stage your project, run tests or build images, you might need to fetch additional libraries or vendors from private repositories.
GitHub Actions only have access to the repository they run for. So, in order to access additional private repositories, create an SSH key with sufficient access privileges. Then, use this action to make the key available with ssh-agent on the Action worker node. Once this has been set up, git clone commands using ssh URLs will just work. Also, running ssh commands to connect to other servers will be able to use the key.