Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Actions with multiple private submodules

I'm trying to create a GH Actions job, which will download two submodules from private repositories. I want them to be downloaded with SSH keys which I have already generated.

I've been trying to it as so:

      - uses: actions/checkout@v2
        with:
          submodules: repo_1
          ssh-key: ${{ secrets.REPO_1 }}

      - uses: actions/checkout@v2
        with:
          submodules: repo_2
          ssh-key: ${{ secrets.REPO_2 }}

This code will create the folders of repo_1 and repo_2, but will be empty. I have not found a possible solution. Does anyone know how to download multiple private submodules with separate SSH keys?

like image 552
This-is-patriiick Avatar asked Nov 14 '25 16:11

This-is-patriiick


1 Answers

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

You will need to create an encrypted secret called GH_PAT to store the personal access token. This token will need (at minimum) read-only access to the "Contents" category of the main repository and of all the submodules.

I tested this with the v3 of the Checkout action, but I think it will work with v2 as well.

Relevant documentation

like image 119
yottalogical Avatar answered Nov 17 '25 07:11

yottalogical



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!