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

docs: explain how to use presets #21534

Merged
merged 13 commits into from
Apr 17, 2023
Merged
5 changes: 4 additions & 1 deletion docs/usage/config-presets.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ In short, the number of `{{argx}}` parameters in the definition is how many para
Parameters must be strings, non-quoted, and separated by commas if there are more than one.

If you find that you are repeating config a lot, you might consider publishing one of these types of parameterised presets yourself.
Or if you think your preset would be valuable for others, please contribute a PR to the Renovate repository.
Or if you think your preset would be valuable for others, please contribute a PR to the Renovate repository, see [Contributing to presets](#contributing-to-presets).

## GitHub-hosted Presets

Expand Down Expand Up @@ -213,6 +213,9 @@ Renovate will determine the current platform and look up the preset from there.
Have you configured a rule that you think others might benefit from?
Please consider contributing it to the [Renovate repository](https://github.com/renovatebot/renovate/tree/main/lib/config/presets/internal) so that it gains higher visibility and saves others from reinventing the same thing.

Create a [discussion](https://github.com/renovatebot/renovate/discussions) to propose your preset to the Renovate maintainers.
The maintainers can also help improve the preset, and let you know where to put it in the code.

## Organization level presets

Whenever repository onboarding happens, Renovate checks if the current user/group/org has a default config to extend.
Expand Down
3 changes: 2 additions & 1 deletion docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@ The above would mean Renovate would not include files matching the above glob pa

## extends

See [shareable config presets](https://docs.renovatebot.com/config-presets) for details.
See [shareable config presets](./config-presets.md) for details.
Learn how to use presets by reading the [Key concepts, Presets](./key-concepts/presets.md/#how-to-use-presets) page.

## extractVersion

Expand Down
21 changes: 21 additions & 0 deletions docs/usage/key-concepts/presets.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ Use presets to:
- Share your configuration with others
- Use somebody else's configuration and extend it with your own rules

## How to use presets

Let's say you're using the `config:base` preset, and want to pin your GitHub Action digests.
Instead of writing your own Renovate config, you search through Renovate's built-in presets.
You find the the `helpers:pinGitHubActionDigests` preset and add it to the `extends` array:

```json
{
"extends": ["config:base", "helpers:pinGitHubActionDigests"]
}
```

Renovate now follows the rules for `config:base` plus the rules for `helpers:pinGitHubActionDigests`.
HonkingGoose marked this conversation as resolved.
Show resolved Hide resolved
If there is a logical conflict between presets, then the last preset in the array wins.

## Managing config for many repositories

If you manage Renovate for many repositories, then you should create a global preset configuration.
Expand All @@ -32,6 +47,12 @@ Renovate comes with a lot of built-in presets that you can use.
Browse [Renovate's default presets](https://docs.renovatebot.com/presets-default/) to find any that are useful to you.
Once you find a preset you like, put it in an `extends` array in your config file.

### Contributing a new built-in preset
HonkingGoose marked this conversation as resolved.
Show resolved Hide resolved

If you have a Renovate config that may help others, you can put it into Renovate's built-in presets.

Read [Contributing to presets](./config-presets.md#contributing-to-presets) to learn how.

## Summary

In short:
Expand Down