When checking out a repo on Github Actions workflow, how do I pass in a key for a private submodule but not the repo itself? This is currently how I am doing it: The ACCESS_KEY is the private key of a deploy key which is stored in the main repo. That key should only apply to the submodule and not the repo itself though. How can I force that functionality? Currenly I get an error because it is trying to use the SSH key to checkout the main repo.

- uses: actions/checkout@v3
  with:
      submodules: 'true'
      ssh-key:  ${{ secrets.ACCESS_KEY }}
1

There are 1 best solutions below

3
jaspernygaard On

Specify token parameter with a PAT from e.g. a machine user or just your personal user.

  - uses: actions/checkout@v3
    with:
      submodules: recursive
      token: ${{ secrets.ACCESS_TOKEN_FOR_SUBMODULES }}