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
[BUG] Locate the merge-base of a PR branch instead of a relying on the fetch-depth. #704
Comments
Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience. |
@lpulley Given that this is an expected behaviour I’ll recommend you take a look at https://github.com/orgs/community/discussions/25437#discussioncomment-3247910 You can also increase the depth of the base branch history that is pulled by using the See inputs for more information. |
I understand how the GitHub merge commits work and that they are not entirely up to date with the target branch if the target branch moves after the PR has been synchronized. I get that. My problem is that The reason I believe this is a bug is that in the case I outlined above, |
Are you saying that this is happening because it's giving up after fetching 20 commits back by default? |
@jackton1 is there a reason why |
Yes |
You can increase the number i.e |
GITHUB_EVENT_PULL_REQUEST_BASE_SHA
isn't actually the head of the base branch, and fetch-depth: 2
failsavoids all its bugs alltogether eg tj-actions/changed-files#704
@lpulley @ericLemanissier This should now be available in the latest release. |
* github actions: don't use tj-actions/changed-files avoids all its bugs alltogether eg tj-actions/changed-files#704 * fix forks * add github token * don't use PurePath.is_relative_to * fixup * add yml error * add conanfile.py error * add test error * touch linter * use fnmatch * fxup * use a dedicated action * Update config.yml * Update conanfile.py * Update conanfile.py * Update conanv2_transition.py Co-authored-by: ericLemanissier <ericLemanissier@users.noreply.github.com>
* github actions: don't use tj-actions/changed-files avoids all its bugs alltogether eg tj-actions/changed-files#704 * fix forks * add github token * don't use PurePath.is_relative_to * fixup * add yml error * add conanfile.py error * add test error * touch linter * use fnmatch * fxup * use a dedicated action * Update config.yml * Update conanfile.py * Update conanfile.py * Update conanv2_transition.py * improve file matching python's fnmatch treats * as any character any number oftime, including /. This is not coherent with bash, which excludes / from *. The fix is to split the pattern and filenames by / and call fnmatch on each part. * add a test error * fixup * silence warning * Update conanfile.py Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
Is there an existing issue for this?
Does this issue exist in the latest version?
Describe the bug?
We tried
fetch-depth: 0
, but it was too slow in our large repository.fetch-depth: 2
usually works, but occasionallychanged-files
seems to be determining the wrongGITHUB_EVENT_PULL_REQUEST_BASE_SHA
.To Reproduce
We're encountering this issue on a private repository. What I can say is that in this case, I have a developer who branched from the main branch, did work, committed a few commits, and created a PR. In the meantime, the main branch had some commits merged into it. Business as usual.
All the previous
changed-files
jobs in this PR worked fine, but the most recent one didn't. ItsGITHUB_EVENT_PULL_REQUEST_BASE_SHA
seems to be wrong -- the GitHub merge commit that the job ran on has a parent that is a descendant ofGITHUB_EVENT_PULL_REQUEST_BASE_SHA
.We check out
746c624
:whose main branch parent is
df0d28b
:and for some reason
changed-files
is expecting to finddf0d28b
's ancestore7b29ba
:but it can't, so it complains that we haven't fetched deeply enough:
What OS are you seeing the problem on?
all
Expected behavior?
I expect
fetch-depth: 2
to work as it usually does. I also would expectGITHUB_EVENT_PULL_REQUEST_BASE_SHA
to be the parent of the check merge commit, and not some older ancestor of it.Relevant log output
No response
Anything else?
Git version is 2.38.1. Runner is our own (self-hosted).
Code of Conduct
The text was updated successfully, but these errors were encountered: