actions / checkout

Action for checking out a repo
https://github.com/features/actions
MIT License
5.93k stars 1.76k forks source link

Checkout with submodules? #81

Closed DethRaid closed 4 years ago

DethRaid commented 4 years ago

How do I checkout with submodules?

Before the most recent commit to master (https://github.com/actions/checkout/commit/e347bba93bdcadab0b55e4b333254f9bb40bdb0c) I could use submodules:true to checkout with submodules.. but it looks like yalls just removed that?

This change caused my most recent Actions checks (https://github.com/NovaMods/nova-renderer/runs/331364250) to fail to checkout

Unless I'm missing something, it seems that yalls updated the checkout action to not support submodules and that broke my Actions check

ericsciple commented 4 years ago

@DethRaid make sure to pin to checkout/actions@v1 which will restore the functionality. Currently it's not supported in v2

DethRaid commented 4 years ago

I actually made a PR to do just that: https://github.com/NovaMods/nova-renderer/pull/225

It's really great when I merge a PR that had no CI failures, only for master to have CI failures because GitHub removed a feature I was using

I guess it's my own fault for not using a specific version of this Action but it still sucks

osyrisrblx commented 4 years ago

Are there plans to support submodules in v2? I'd appreciate the perf improvements, but I do need submodules. 😄

Of course, for now I'll stick with v1.

gunnsth commented 4 years ago

Submodules with SSH checkout would be great

ChristophWurst commented 4 years ago

Hey @ericsciple!

Thanks for your fixes in #112. In our organization we have to deal with submodules a lot and thus I would like to kindly ask why the shortcut of with.submodules was removed from v2? I don't find the

run: |
    auth_header="$(git config --local --get http.https://github.com/.extraheader)"
    git submodule sync --recursive
    git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1

easy to use considering that I maintain many repositories. Would it be possible to revive the with.submodules shortcut?

ericsciple commented 4 years ago

good feedback @chrispat fyi

eine commented 4 years ago

@ericsciple, @chrispat, any updates about this issue? Did you consider to reopen it?

ericsciple commented 4 years ago

reopening and mark as enhancement for consideration

marcofranssen commented 4 years ago

This only seems to work for submodules using https.

run: |
    auth_header="$(git config --local --get http.https://github.com/.extraheader)"
    git submodule sync --recursive
    git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1

I need it to work via SSH. Anyone knows how to make this work with SSH?

webknjaz commented 4 years ago

@marcofranssen you can use https://github.com/marketplace/actions/webfactory-ssh-agent to spawn an ssh-agent and add appropriate SSH private keys there. After that, your tools that use SSH should pick them up.

marcofranssen commented 4 years ago

@webknjaz thanks, will give that a try as well. I finally managed to fix it by replacing the ssh with https address as explained in https://github.com/actions/checkout/pull/140/files

chrispat commented 4 years ago

Just to provide some background context.

We chose to leave submodules out of the v2 rewrite for two main reasons. First because Actions is a per repository app installation the default token does not provide access to other private repositories even in the the same org or account. Second many developers configured their submodules to use SSH instead of HTTPS and in that case even public submodules would fail.

As such we decided to take a step back and see what options we had to provide a better support for public and private submodules using HTTPS or SSH. Unfortunately the developer who had been working on this issue had to take some unexpected time off to attend to a family matter.

He is back now and you should expect to see an update coming to the repo with our proposal for how we would like to add this functionality back. We look forward to the communities comments on the pull request.

eine commented 4 years ago

He is back now and you should expect to see an update coming to the repo with our proposal for how we would like to add this functionality back.

Is it expected to be a fix to v2 or a new v3?

chrispat commented 4 years ago

Since it should just be additive it will be an update to v2.

ericsciple commented 4 years ago

Opened a PR to propose SSH support here which will help for users scripting submodule checkout.

Will open a separate proposal shortly for a first-class submodules input.

sjackman commented 4 years ago

A related problem with Rust is cargo downloading crates from private repos. I solved this problem by creating a PAT and adding it to the repo's secrets named GITHUB_PAT:

echo 'https://USERNAME_OF_PAT:${{secrets.GITHUB_PAT}}@github.com' >~/.git-credentials
git config --global credential.helper store
cargo test

Worked like a charm!

Can USERNAME_OF_PAT be omitted? Can you use either https://x-auth-token:${{secrets.GITHUB_PAT}}@github.com or https://${{secrets.GITHUB_PAT}}@github.com?

ericsciple commented 4 years ago

An input submodules has been added now. I merged to master, try it out and let me know. Collecting feedback and will update the v2 tag next week.

Also I'm hoping to merge support for SSH soon.

ericsciple commented 4 years ago

I created a new issue to collect feedback on the submodules input - in master now, will update v2 tag next week.

ericsciple commented 4 years ago

Thanks all for the feedback! I updated V2 to include the recent submodule/SSH changes from master.