-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
In master/v2, cannot checkout PR base sha #93
Comments
Checkout v2 was optimized for the mainline case, fetch only the single commit. If it's just the base commit that you need, you can fetch that single commit:
Note, this works because Thoughts? I also wonder whether an input to control the refspec would be good. I have some thoughts, but not fully fleshed out yet. |
Ah, nice. I'll try it later :) Maybe it would be nice to add things like this to the docs/readme, as I guess it is not an uncommon use case (to compare something for a PR)! |
I feel like this would be something to support as part of the default API for this action 🤔 there are plenty of people that will be writing Actions that are trying to do diffs between the head of a PR and master. something like |
Spitballing... I'm thinking something like an input With some easy options built-in like:
maybe another option |
Yea that works for me 👍 @ericsciple how do you feel about |
@mansona I think that's fair. The goal of checkout v2 was perf improvements, so we switched to fetching a single commit by default. For a PR I don't think fetching two commits by default is bad (most git objects likely shared by the two commits anyway). Good discussion here. Thanks. |
@chrispat fyi, good feedback here to consider re v2 enhancements |
Here is a similar issue that is related to this discussion. Although it is a tags scenario. Whereas this issue is about base ref scenario. |
I like the idea of a |
Just wanted to mention that GH sets github.base_ref and so, while waiting for this, I think it works to do something like this to get just the target branch (e.g. for diffing):
Looking forward to removing this from my workflows when this action fetches it by default. |
Proposal here to add an additional input: #155 |
Following [actions/checkout@v1 issue](actions/checkout#93) we need to checkout more git history for the diff result.
Since this seems to be a common scenario and is generating a lot of discussion (actions#93), it seems worthwhile to add it to the readme as an example. I placed it before the other fetch examples because this use-case still only fetches minimal history (only adding one additional ref); so it seems helpful to place this above the other fetch examples which all do deeper fetches.
When running LHCI in GH Actions due to how checkout action clones the repo with a fetch depth of 1 by default the base branch might be missing so LH will not be able to find it during health check. Changing the action settings and fetching the base using a new step will fix this problem for almost all cases where the repo is big enough. This has been discussed here actions/checkout#93 and here actions/checkout#213
I guess this is related to #15 - I used to be able to get the base commit of a PR (to compare code coverage - here: https://github.com/mydea/ember-cli-code-coverage-action/) and check it out - which stopped working in master/v2. After some digging, I figured it was because that commit was not fetched anymore.
How would I need to configure v2 to make this work again? Thank you!
The text was updated successfully, but these errors were encountered: