renovate.star¶
Edit Renovate configs: presets, package rules, schedules and other settings.
Works on JSON configs (renovate.json, .github/renovate.json, .renovaterc
and .renovaterc.json), keeping key order and indentation. JSON5 configs
can't be edited this way and are skipped by find.
load("@fleet//renovate.star", "find", "add_preset", "remove_preset", "replace_preset", "add_package_rule", "set_option")
| Function | What it does |
|---|---|
find |
Finds the repo's Renovate config. |
add_preset |
Adds a preset to extends unless it is already there. |
remove_preset |
Removes a preset from extends, such as a retired config:base. |
replace_preset |
Replaces a preset in extends where it is, such as config:base with config:recommended. |
add_package_rule |
Appends a rule to packageRules unless an identical rule is already there. |
set_option |
Sets a top-level or nested option, such as schedule or lockFileMaintenance.enabled. |
find¶
Finds the repo's Renovate config.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: The path of the first JSON config that exists, or None.
Example
add_preset¶
Adds a preset to extends unless it is already there.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
preset |
The preset, such as config:recommended or github>acme/renovate-config. |
Returns: True when the file changed.
Example
remove_preset¶
Removes a preset from extends, such as a retired config:base.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
preset |
The preset to remove. |
Returns: True when the file changed.
Example
replace_preset¶
Replaces a preset in extends where it is, such as config:base with config:recommended.
When new is already there too, old is just removed.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
old |
The preset to replace. |
new |
The preset to put in its place. |
Returns: True when the file changed.
Example
Used in: renovate-automerge
add_package_rule¶
Appends a rule to packageRules unless an identical rule is already there.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
rule |
The rule, a dict such as {"matchUpdateTypes": ["patch"], "automerge": True}. |
Returns: True when the file changed.
Example
Used in: renovate-automerge
set_option¶
Sets a top-level or nested option, such as schedule or lockFileMaintenance.enabled.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
key |
The dotted option path. |
value |
Any JSON value. |
Returns: True when the file changed; False when the repo has no config.
Example