Skip to content

Commit 9a96a4d

Browse files
authored
docs(key concepts, automerge): partial rewrite (renovatebot#35410)
1 parent 5224255 commit 9a96a4d

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

docs/usage/key-concepts/automerge.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,29 @@ description: Learn all about Renovate's automerge functionality here
55

66
# Introduction
77

8-
Automerging is a Renovate feature that you can use to automate upgrading dependencies.
9-
When enabled, Renovate tries to merge the proposed update once the tests pass.
8+
You can choose to automate some dependency updates by letting Renovate automerge its PR.
9+
Renovate will wait for the required tests to pass before it automerges.
1010

11-
Keep in mind that Renovate automerges take a bit of time, do not expect Renovate to automerge a PR the second it opens and passes tests.
12-
Wait for at least an hour or two before troubleshooting to ensure that Renovate has had the time to run once in a state where tests have passed and the branch is up-to-date with its base branch.
11+
## Renovate automerges take time
12+
13+
Renovate automerges take time, so Renovate can't automerge a PR the second it passes your required tests.
14+
Before you start troubleshooting, wait!
15+
Give Renovate about two hours, so Renovate can run in a state where your tests have passed, and the PR branch is up-to-date with the base branch.
1316
If you or others keep committing to the default branch then Renovate cannot find a suitable gap to automerge into!
1417

15-
Once a branch is automerged, the "Git state" needs to be recalculated for every remaining branch.
16-
At times, merging one branch could result in another branch's updates being changed or even removed as unnecessary.
17-
Renovate's approach is to ensure that automerging branches are up-to-date with their target branch before automerging.
18-
This means merging multiple branches in a row won't work reliably, so we prefer not to do that.
19-
What all this means is that Renovate will only automerge at most one branch/PR per target branch per run, before you need to wait for the next run.
18+
After Renovate automerges a branch, Renovate must calculate the "Git state" again, for all remaining branches.
19+
Merging one branch may result in another branch's updates being changed, or even removed as no longer needed.
20+
Renovate requires automerging branches to be up-to-date with their target branch, _before_ automerging.
21+
As merging more than one branch in a row does not work _reliably_, Renovate will only automerge one branch/PR, per target branch, per run.
22+
Then you'll have to wait for the next time Renovate runs.
23+
24+
## Recommendations from the Renovate maintainers
2025

21-
As a general guide, we recommend that you enable automerge for any type of dependency updates where you would select "merge" anyway.
22-
For any updates where you want to review the changelogs - or code - before you merge, you can keep automerge disabled.
26+
In general, we recommend you enable automerge for any dependency update where you would select "merge" anyway.
27+
Keep automerge _disabled_ for updates where you want to read the changelogs or code before the merge.
2328

24-
Automerge works particularly well for `devDependencies` as well as for production `dependencies` in projects which have great test coverage.
29+
Automerge often works well for `devDependencies`.
30+
It can work for production `dependencies` too, but your project should have good test coverage.
2531

2632
For example, if you have Jest or Mocha as a development dependency, and it has an upgrade with passing tests... automerge them!
2733
If you have a linter like ESLint or TSLint and its update passes... automerge them!
@@ -34,7 +40,8 @@ If you have an API with 100% test coverage and Express is updated... automerge i
3440
### Automerge lock file maintenance
3541

3642
The lowest risk type of update to automerge is probably `lockFileMaintenance`.
37-
When Renovate performs lock file maintenance, it leaves the project dependency definitions unchanged, but refreshes the lock file completely so that the latest versions according to the package file constraints are installed.
43+
When Renovate performs lock file maintenance, it leaves the project dependency definitions unchanged, but refreshes the lock file completely.
44+
This means Renovate installs the latest versions, that match the package file constraints.
3845

3946
```json title="Example of automerging lock file maintenance"
4047
{
@@ -48,8 +55,11 @@ When Renovate performs lock file maintenance, it leaves the project dependency d
4855
### Automerge lint tool updates
4956

5057
Automerging lint tool updates can be a real time-saver.
51-
Sometimes an update to a lint tool or plugin definition causes tests to fail, and that is usually deliberate/intentional because the lint authors have added a new rule that you need to adhere to.
52-
But in many cases the new version(s) will pass tests, and if so then there's really nothing else to consider before merging, so they may as well be automerged:
58+
Often a new lint tool version pass the updated tests, without any code changes on your end.
59+
If the tests pass you may as well automerge the PR.
60+
61+
In cases where you need to make changes to your code, the Renovate PR will fail the linter check.
62+
You can then make the necessary code changes directly in the Renovate branch for that PR, confirm the tests pass with your changes, and manually merge the PR.
5363

5464
```json title="Example of automerging lint and Prettier development packages"
5565
{

0 commit comments

Comments
 (0)