-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support baseBranches when forkMode=true #7850
Comments
We currently only sync the default branch during repository initialisation so that would explain it. We'd need to do the syncing during base branch iteration but that's going to require quite a refactoring to achieve. We probably should note in the documentation that baseBranches is currently incompatible with forkMode |
@HonkingGoose could you also add this note regarding forking renovate? i.e. that |
Attempting to revive this issue. There is an API dedicated to syncing a fork with its upstream (branch by branch basis) since September 2021: https://docs.github.com/en/rest/reference/branches#sync-a-fork-branch-with-the-upstream-repository Could this be used to synchronize With my limited understanding of how that part of Renovate works, I feel like it could be a viable solution with the following characteristics:
My javascript/typescript is rusty (that's an understatement) and I'm sure I'm missing something, but looking at |
Another challenge to solve is knowing the config filename to avoid many try/catch/retry attempts to read it. Or limiting it to renovate.json if baseBranches support is necessary. Also I think the original "hack" might work for base branches too using your proposed approach |
Isn't that already the case with the current arrangement? Or maybe the current expectation is that the config is read from each "base branch(es)"? Having a constraint on the renovate config file location seems like a small price to pay 👍 |
We already have that challenge in general, but we address it after clone. In other words much later than "initialization of the fork" as you wrote here:
So if you first clone the repo, discover the config file name, and THEN use the github API to sync each base branch, then the repo on github.com would be up to date but your local copy would not be (you'd need to pull each branch too, so it starts getting messy). |
We need to revive and extend the changes I made in #13808 These were reverted out of caution, it turned out to be unnecessary. |
So I'm trying to figure out what's the current situation here. I made a comment #14253 (comment) to a discussion to see if there is a "hack" one can use to overcome the limitations. @rarkins Can you sum up your understanding of where this stands now in 2025? Background: For our project (Apache Solr) we tried dependabot but it could not handle our requirement to run postUpgradeTasks. Also, as only committers are allowed content-write access to the main code repository, we really need the forking mode to compy with policies, so we have our own @solrbot user running renovate, currenlty on default PS: I have already contributed to renovate (got the T-shirt 😉), so I could be willing to collaborate on this, or at least test out a feature-branch. |
@janhoy thanks for your interest Copy-pasting my answer from #14253 (reply in thread) to here:
Which brings us to #13586 (which is a prerequisite for this issue here). I already wrote code for that long ago here: #13808 It was reverted in #13831 but that was out of misunderstanding/caution. It turned out that the errors came from a token which didn't have workflow permissions, so would have had problems using either approach of syncing branches. So if you're feeling motivated to progress this, I'd recommend taking #13808 as a starting point and essentially just porting it to today's main branch, which might be a little different. Let me know if you'd like to be assigned! |
Hi again. See my PR for an attempt of bringing your 3 year old commit to main branch. Some files had moved and some adaptions needed. We can continue discussion over in the PR. |
I'd like to start a new PR on top of the git fetch one, to make baseBranches work in forking mode. Q: Do we have a test harness capable of simulating multi multi branch github in forking mode? If so it would be great to first add a unit test to #34467 proving all branches get synced, and another (failing) test for full baseBranches support. |
We're right in the middle of switching from jest to vitest so it would be best to hold off temporarily from adding or modifying further tests until it's merged |
My own understanding of the code involved is getting better. Syncing the main branch in the fork went well, but of course during
I first attempted adding sync to If at all possible to sync git repo in the handy @simonbasle Are you still interested in this feature? |
@janhoy I still think this would be a usual feature for the Renovate bot, although I've since moved away from using it...
…-------- Message d'origine --------
Le 27/02/2025 12:09, Jan Høydahl a écrit :
My own understanding of the code involved is getting better.
I've setup a [dummy repo](https://github.com/cominvent/dummy) with two branches, for testing, and I run the PR-branch code in my IDE, with a token that forks to [another github user](https://github.com/janhoy/cominvent-_-dummy).
Syncing the main branch in the fork went well, but of course during extractDependencies we get error
> WARN: Base branch does not exist - skipping (repository=cominvent/dummy, baseBranch=dev)
I first attempted adding sync to util/git#syncGit(), but soon found out as noted above, that we have not parsed repo config yet at this point. So I had a shot at repository/process#extractDependencies() where we do have access to a scm object. However, the scm tool, although similar to git, does not have capability of handling upstream/.
If at all possible to sync git repo in the handy for (const baseBranch of config.baseBranches) loop before extraction, that would be sweet. But we'd have to use the git tooling, and would probably need to validate first that the checked-out repo is in fact a git(hub) repo. Ideas?
***@***.***(https://github.com/simonbasle) Are you still interested in this feature?
—
Reply to this email directly, [view it on GitHub](#7850 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABVJTNXQ6SPCKS4MGYQNRIL2R3W7TAVCNFSM6AAAAABVZJJLEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBXGYZTGNZRGM).
You are receiving this because you were mentioned.Message ID: ***@***.***>
[janhoy]janhoy left a comment [(renovatebot/renovate#7850)](#7850 (comment))
My own understanding of the code involved is getting better.
I've setup a [dummy repo](https://github.com/cominvent/dummy) with two branches, for testing, and I run the PR-branch code in my IDE, with a token that forks to [another github user](https://github.com/janhoy/cominvent-_-dummy).
Syncing the main branch in the fork went well, but of course during extractDependencies we get error
> WARN: Base branch does not exist - skipping (repository=cominvent/dummy, baseBranch=dev)
I first attempted adding sync to util/git#syncGit(), but soon found out as noted above, that we have not parsed repo config yet at this point. So I had a shot at repository/process#extractDependencies() where we do have access to a scm object. However, the scm tool, although similar to git, does not have capability of handling upstream/.
If at all possible to sync git repo in the handy for (const baseBranch of config.baseBranches) loop before extraction, that would be sweet. But we'd have to use the git tooling, and would probably need to validate first that the checked-out repo is in fact a git(hub) repo. Ideas?
***@***.***(https://github.com/simonbasle) Are you still interested in this feature?
—
Reply to this email directly, [view it on GitHub](#7850 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABVJTNXQ6SPCKS4MGYQNRIL2R3W7TAVCNFSM6AAAAABVZJJLEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBXGYZTGNZRGM).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I made progress in #34532 which succeeds in syncing each baseBranch in the exiting loop inside |
What Renovate type, platform and version are you using?
GHE, 23.89.3
Describe the bug
We are running a self-hosted renovate bot in fork mode. If we include a non-default branch in
baseBranches
, the same PR is created multiple times or conflicting PRs are created for that branch.Non-default branches appear to be out of sync with fork and upstream. I wondered if this was creating bad PRs.
Relevant debug logs
Synchronization is likely to be performed here, but only the default branch will be updated.
renovate/lib/platform/github/index.ts
Lines 318 to 325 in bffd90d
To Reproduce
system conf:
repository conf:
Additional context
The text was updated successfully, but these errors were encountered: