From 47436a98d88557b9158d58156c7993855c502c4f Mon Sep 17 00:00:00 2001 From: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Date: Sat, 16 Jul 2022 13:57:12 +0200 Subject: [PATCH] docs(semantic commit messages): rewrite (#16560) --- docs/usage/semantic-commits.md | 75 ++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/docs/usage/semantic-commits.md b/docs/usage/semantic-commits.md index f3ea947a496eac..5ba0f2e1f4f0e5 100644 --- a/docs/usage/semantic-commits.md +++ b/docs/usage/semantic-commits.md @@ -5,40 +5,83 @@ description: Configuring Renovate to use Semantic Commits # Semantic Commit messages -To detect if your repository uses semantic commits, Renovate looks at the latest 10 commit messages in the base branch. -It then uses [conventional-commits-detector](https://github.com/conventional-changelog/conventional-commits-detector) to determine what convention the commit messages follow. +Renovate looks at the last 10 commit messages in the base branch to decide if the repository uses semantic commits. +If there are semantic commits, Renovate uses the [conventional-commits-detector](https://github.com/conventional-changelog/conventional-commits-detector) to decide what convention the commit messages follow. -Renovate only detects Angular-style conventional commits, it ignores all other commit conventions. +Renovate only finds Angular-style conventional commits, it ignores other commit conventions. -When Renovate finds Angular-style commits, Renovate will create commit messages and PR titles that look like this: +When Renovate finds Angular-style commits, Renovate creates commit messages and PR titles like this: - chore(deps): update eslint to v7.30.0 -- fix(deps): update express to v4.17.1 -Renovate uses the `chore` prefix by default. -When you extend `config:base`, Renovate still defaults to `chore`, but will use the `fix` prefix for npm production dependencies (`devDependencies` still use `chore`). +By default, Renovate uses the `chore` prefix. + +If you extend from `config:base` then Renovate: + +- still defaults to the `chore` prefix +- uses the `fix` prefix for npm production dependencies +- uses the `chore` prefix for npm development dependencies (`devDependencies`) ## Manually enabling or disabling semantic commits You can override the default settings, and disable or enable semantic commits. -If you want Renovate to use semantic commits: add `":semanticCommits"` to your `extends` array. +If you want Renovate to use semantic commits: add `":semanticCommits"` to your `extends` array: + +```json +{ + "extends": [":semanticCommits"] +} +``` -If you want Renovate to stop using semantic commits, add `":semanticCommitsDisabled"` to your `extends` array. +If you want Renovate to stop using semantic commits: add `":semanticCommitsDisabled"` to your `extends` array: + +```json +{ + "extends": [":semanticCommitsDisabled"] +} +``` ## Changing the Semantic Commit type You can change the Semantic Commit type that Renovate uses. +For example: + +- If you want Renovate to use the "chore" type for every PR, add `":semanticCommitTypeAll(chore)"` to your `extends` array: -Say you want Renovate to use "chore" for every PR, you can add `":semanticCommitTypeAll(chore)"` to your `extends` array. -PR titles and commit messages start with "chore(deps):" + ```json + { + "extends": [":semanticCommitTypeAll(chore)"] + } + ``` -Or say you want to use "ci" for every PR, then you would add `":semanticCommitTypeAll(ci)"` to your `extends` array instead. -PR titles and commit messages start with "ci(deps):" + PR titles and commit messages start with `chore(deps):`. + +- If you want Renovate to use the "ci" type for every PR, add `":semanticCommitTypeAll(ci)"` to your `extends` array: + + ```json + { + "extends": [":semanticCommitTypeAll(ci)"] + } + ``` + + PR titles and commit messages start with `ci(deps):`. ## Changing the Semantic Commit scope -If you don't like the default "deps" scope, you can use another word for the scope instead. -For example, to set the scope to "package" instead, add the preset `":semanticCommitScope(package)"` to your `extends` array. +You can set your own word for the scope if you don't like the default "deps" scope. +For example, to set the scope to "package", add the preset `":semanticCommitScope(package)"` to your `extends` array: + +```json +{ + "extends": [":semanticCommitScope(package)"] +} +``` + +To _remove_ the semantic commit scope, so Renovate uses `chore:` instead of `chore(deps):`, add the `":semanticCommitScopeDisabled"` preset to your `extends` array: -If you want to _remove_ the semantic commit scope (e.g. use prefix `chore:` instead of `chore(deps):`), then add the preset `":semanticCommitScopeDisabled"` to your `extends` array. +```json +{ + "extends": [":semanticCommitScopeDisabled"] +} +```