You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage/key-concepts/automerge.md
+25-15Lines changed: 25 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,23 +5,29 @@ description: Learn all about Renovate's automerge functionality here
5
5
6
6
# Introduction
7
7
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.
10
10
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.
13
16
If you or others keep committing to the default branch then Renovate cannot find a suitable gap to automerge into!
14
17
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
20
25
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.
23
28
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.
25
31
26
32
For example, if you have Jest or Mocha as a development dependency, and it has an upgrade with passing tests... automerge them!
27
33
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
34
40
### Automerge lock file maintenance
35
41
36
42
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.
38
45
39
46
```json title="Example of automerging lock file maintenance"
40
47
{
@@ -48,8 +55,11 @@ When Renovate performs lock file maintenance, it leaves the project dependency d
48
55
### Automerge lint tool updates
49
56
50
57
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.
53
63
54
64
```json title="Example of automerging lint and Prettier development packages"
0 commit comments