name: "setup ssh git"
description: setup an ssh key and configure git to use it instead of https
inputs:
  key:
    description: "a private ssh key that has access to the required repos"
    # default: ${{ secrets.PLUTO_DEPLOY_SSH_KEY }}
    required: false
runs:
  using: "composite"
  steps:
    - shell: bash
      name: setup ssh git
      run: |
        mkdir -p ~/.ssh
        # add the host keys to known_hosts file
        ssh-keyscan github.com >> ~/.ssh/known_hosts
        # put down the ssh key
        echo "${{ inputs.key }}" > ~/.ssh/id_rsa
        chmod 400 ~/.ssh/id_rsa
        # set git to use ssh instead of https
        git config --global \
            url."git@github.com:".insteadOf \
            "https://github.com/"
