Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very silly question: how is it supposed to be used? #91

Closed
KubaO opened this issue Aug 21, 2021 · 4 comments · May be fixed by #92
Closed

Very silly question: how is it supposed to be used? #91

KubaO opened this issue Aug 21, 2021 · 4 comments · May be fixed by #92

Comments

@KubaO
Copy link

KubaO commented Aug 21, 2021

The top-level readme has no mention of how to actually use this thing. Yes, I know how to add the keys, but how do we actually consume the keys?

This doesn't work - and that's what most people would expect should be working, otherwise what's the point?

      - uses: webfactory/[email protected]
        with:
          ssh-private-key: |
                ${{ secrets.repo1}}
                ${{ secrets.repo2}}
      - uses: actions/checkout@v2
        with:
          path: source
          submodules: recursive

The example in the readme also has the checkout preceding the ssh-agent setup, and that won't ever work since the keys need to be set up when the checkout happens, not before. So I'm a bit baffled as to what this is supposed to be doing...

@KubaO
Copy link
Author

KubaO commented Aug 21, 2021

It looks like the checkout action basically undoes the whole thing - the log has this tidbit:

"C:\Program Files\Git\bin\git.exe" config --global --unset-all url.https://github.com/.insteadOf

So I guess the trick is not to use the checkout action with submodules, but have a manual git submodule update --init --recursive...?

@KubaO
Copy link
Author

KubaO commented Aug 21, 2021

That actually did the trick.

@mpdude
Copy link
Member

mpdude commented Aug 27, 2021

You are right that the README example has the actions/checkout before this action. That’s because usually, you use actions/checkout to clone the repo itself which does not need extra SSH keys 🔑. Keys are only needed for extra repos, e. g. installed by dependency managers later on.

In your case of Git submodules (which I have never worked with, to be honest) my understanding is you need the SSH keys to clone those. In that case, there should be no problem to add the keys before actions/checkout.

You write that actions/checkout modifies the Git config for .insteadOf. That might in fact be a problem when the submodules work using https:// URLs and you need to use more than one key (deployment keys).

@mpdude
Copy link
Member

mpdude commented Aug 28, 2021

@KubaO could you please try if it is possible to

  • use SSH URLs when setting up the submodules,
  • use webfactory/ssh-agent before the actions/checkout
  • and then use the submodule initialization built into actions/checkout?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants