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

feat: Add new keepUpdatedLabel config setting #27542

Merged
merged 13 commits into from Mar 1, 2024

Conversation

mheffner
Copy link
Contributor

@mheffner mheffner commented Feb 25, 2024

Changes

This adds the keepUpdatedLabel config setting.

Adding the keepUpdatedLabel label to a PR makes Renovate behave
as if rebaseWhen were set to behind-base-branch, but only for the given PR. The label is not removed from the PR
after the rebase is complete, unlike rebaseLabel.

This can be useful when you have approved certain PRs and want to keep them updated until they are ready
to be merged. The setting keepUpdatedLabel is best used in conjunction with rebaseWhen set to the
values of never or conflicted that limit rebasing.

Context

The motivation for this change came out of the discussion about managing the use of renovate bot alongside kodiakhq bot: #27328. It was suggested by the Renovate maintainer that a new option could be added that allowed a user to opt-in given PRs to rebase updates.

This provides an implementation of that option from my best understanding of the existing code. It mostly follows the use of rebaseWhen, modifying the behavior if keepUpdatedLabel is set and the label is included on the PR.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

This config setting will keep a PR updated if it has the keepUpdatedLabel
label set in the PR. This allows a user to opt-in a PR to continual
updating, even if rebaseWhen is set to never or conflicted.
@mheffner mheffner changed the title Add new keepUpdatedLabel config setting feat: Add new keepUpdatedLabel config setting Feb 25, 2024
@rarkins
Copy link
Collaborator

rarkins commented Feb 25, 2024

I had expected it should behave like rebaseWhen=behind-base-branch, not auto. Why don't think auto is a better approach? In some cases auto won't update the PR, which would seem like a bug to the user if you've configured a keepUpdatedLabel

@mheffner
Copy link
Contributor Author

You're right, I would expect this to behave like behind-base-branch. I actually believe that is the behavior of the change set, but that the option setting documentation was wrong. I just pushed a change to update the documentation for the option to what I believe is the behavior here.

I tested this on a repo with the "require branches be up-to-date" setting both on and off. In both cases if the keepUpdatedLabel was applied to a PR, it was rebased. Are there any scenarios you see in the changeset that I may not have handled?

docs/usage/configuration-options.md Outdated Show resolved Hide resolved
lib/workers/repository/update/branch/reuse.ts Outdated Show resolved Hide resolved
lib/config/options/index.ts Outdated Show resolved Hide resolved
lib/workers/repository/update/branch/reuse.ts Outdated Show resolved Hide resolved
@mheffner
Copy link
Contributor Author

👀 it looks like reuse.ts doesn't have 100% coverage, I'll take a look at adding something to cover what's missing

@mheffner
Copy link
Contributor Author

I pushed a commit that should bump reuse.ts coverage to 100%

@mheffner
Copy link
Contributor Author

mheffner commented Mar 1, 2024

@rarkins Ok, I think I've got the final coverage reports back up to 100%. I missed that requirement when I was running tests locally. 🤦 Do you prefer to resolve the open conversations yourself?

@rarkins rarkins added this pull request to the merge queue Mar 1, 2024
Merged via the queue into renovatebot:main with commit 62d678d Mar 1, 2024
35 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.222.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants