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

Include common example for fetching PR base-ref #213

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jasonkarns
Copy link

Since this seems to be a common scenario and is generating a lot of discussion (#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.

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.
@jasonkarns
Copy link
Author

I haven't verified the table-of-contents link (I typed it by hand)

```yml
- uses: actions/checkout@v2
- name: Fetch base_ref HEAD
run: git fetch --depth=1 origin +refs/heads/${{github.base_ref}}:refs/remotes/origin/${{github.base_ref}}
Copy link
Author

@jasonkarns jasonkarns Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could actually be simplified to

git fetch --depth=1 origin +${{github.base_ref}}

or

git fetch --depth=1 origin +refs/heads/${{github.base_ref}}

since the destination is the conventional remote ref. But I'm unsure if there are any edge cases with that shortened form that users would encounter... (Then again, since this is supposed to be for "common scenarios", perhaps the short form is better?)

@ericsciple
Copy link
Contributor

@jasonkarns thanks will look over this soon!

egpbos added a commit to roofit-dev/root that referenced this pull request Jun 24, 2021
Uses example in as of yet unmerged PR actions/checkout#213
radum added a commit to radum/lighthouse-ci that referenced this pull request Jun 30, 2021
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
Axel-Naumann pushed a commit to root-project/root that referenced this pull request Oct 29, 2021
Uses example in as of yet unmerged PR actions/checkout#213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants