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

feat: commitMessageLowerCase #20930

Merged
merged 12 commits into from May 13, 2023
5 changes: 5 additions & 0 deletions docs/usage/configuration-options.md
Expand Up @@ -3044,6 +3044,11 @@ If configured to `enabled`, then the `semanticCommitScope` and `semanticCommitTy

Renovate autodetects if your repository is already using semantic commits or not and follows suit, so you only need to configure this if you wish to _override_ Renovate's autodetected setting.

## commitMessageLowerCase
rarkins marked this conversation as resolved.
Show resolved Hide resolved

With `semanticCommits` pr- and commit-titles will be converted to all-lowercase. Set this to `auto` to keep this
behaviour, or `never` to leave the titles untouched, which allows uppercase characters in semantic commit titles.
rarkins marked this conversation as resolved.
Show resolved Hide resolved

## separateMajorMinor

Renovate's default behavior is to create a separate branch/PR if both minor and major version updates exist (note that your choice of `rangeStrategy` value can influence which updates exist in the first place however).
Expand Down
7 changes: 7 additions & 0 deletions lib/config/options/index.ts
Expand Up @@ -1514,6 +1514,13 @@ const options: RenovateOptions[] = [
type: 'string',
default: 'deps',
},
{
name: 'commitMessageLowerCase',
description: 'Lowercase PR- and commit titles.',
type: 'string',
allowedValues: ['auto', 'never'],
default: 'auto',
kingcrunch marked this conversation as resolved.
Show resolved Hide resolved
},
// PR Behaviour
{
name: 'rollbackPrs',
Expand Down
1 change: 1 addition & 0 deletions lib/config/types.ts
Expand Up @@ -77,6 +77,7 @@ export interface RenovateSharedConfig {
automergeSchedule?: string[];
semanticCommits?: 'auto' | 'enabled' | 'disabled';
semanticCommitScope?: string | null;
commitMessageLowerCase?: 'auto' | 'never';
rarkins marked this conversation as resolved.
Show resolved Hide resolved
semanticCommitType?: string;
suppressNotifications?: string[];
timezone?: string;
Expand Down
4 changes: 3 additions & 1 deletion lib/modules/platform/azure/index.ts
Expand Up @@ -305,7 +305,9 @@ export async function findPr({
);

if (prTitle) {
prsFiltered = prsFiltered.filter((item) => item.title === prTitle);
prsFiltered = prsFiltered.filter(
(item) => item.title.toUpperCase() === prTitle.toUpperCase()
);
}

switch (state) {
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/bitbucket-server/index.ts
Expand Up @@ -287,7 +287,7 @@ const isRelevantPr =
(branchName: string, prTitle: string | null | undefined, state: string) =>
(p: Pr): boolean =>
p.sourceBranch === branchName &&
(!prTitle || p.title === prTitle) &&
(!prTitle || p.title.toUpperCase() === prTitle.toUpperCase()) &&
matchesState(p.state, state);

// TODO: coverage (#9624)
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/bitbucket/index.ts
Expand Up @@ -291,7 +291,7 @@ export async function findPr({
const pr = prList.find(
(p) =>
p.sourceBranch === branchName &&
(!prTitle || p.title === prTitle) &&
(!prTitle || p.title.toUpperCase() === prTitle.toUpperCase()) &&
matchesState(p.state, state)
);
if (pr) {
Expand Down
4 changes: 3 additions & 1 deletion lib/modules/platform/codecommit/index.ts
Expand Up @@ -206,7 +206,9 @@ export async function findPr({
);

if (prTitle) {
prsFiltered = prsFiltered.filter((item) => item.title === prTitle);
prsFiltered = prsFiltered.filter(
(item) => item.title.toUpperCase() === prTitle.toUpperCase()
);
}

switch (state) {
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/github/index.ts
Expand Up @@ -716,7 +716,7 @@ export async function findPr({
return false;
}

if (prTitle && prTitle !== p.title) {
if (prTitle && prTitle.toUpperCase() !== p.title.toUpperCase()) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/gitlab/index.ts
Expand Up @@ -750,7 +750,7 @@ export async function findPr({
prList.find(
(p: { sourceBranch: string; title: string; state: string }) =>
p.sourceBranch === branchName &&
(!prTitle || p.title === prTitle) &&
(!prTitle || p.title.toUpperCase() === prTitle.toUpperCase()) &&
matchesState(p.state, state)
) ?? null
);
Expand Down
4 changes: 2 additions & 2 deletions lib/workers/repository/updates/generate.ts
Expand Up @@ -226,7 +226,7 @@ export function generateBranchConfig(
regEx(/to vv(\d)/),
'to v$1'
);
if (upgrade.toLowerCase) {
if (upgrade.toLowerCase && upgrade.commitMessageLowerCase === 'auto') {
kingcrunch marked this conversation as resolved.
Show resolved Hide resolved
// We only need to lowercase the first line
const splitMessage = upgrade.commitMessage.split(newlineRegex);
splitMessage[0] = splitMessage[0].toLowerCase();
Expand All @@ -249,7 +249,7 @@ export function generateBranchConfig(
);
throw new Error(CONFIG_SECRETS_EXPOSED);
}
if (upgrade.toLowerCase) {
if (upgrade.toLowerCase && upgrade.commitMessageLowerCase === 'auto') {
kingcrunch marked this conversation as resolved.
Show resolved Hide resolved
upgrade.prTitle = upgrade.prTitle.toLowerCase();
}
} else {
Expand Down