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 @@ -448,6 +448,11 @@ Check out the default value for `commitMessage` to understand how this field is
This is used to alter `commitMessage` and `prTitle` without needing to copy/paste the whole string.
The "extra" is usually an identifier of the new version, e.g. "to v1.3.2" or "to tag 9.2".

## commitMessageLowerCase

With `semanticCommits` pr- and commit-titles will by default (`"auto"`) be converted to all-lowercase.
Set this to `"never"` to leave the titles untouched, allowing uppercase characters in semantic commit titles.

## commitMessagePrefix

This is used to alter `commitMessage` and `prTitle` without needing to copy/paste the whole string.
Expand Down
7 changes: 7 additions & 0 deletions lib/config/options/index.ts
Expand Up @@ -1549,6 +1549,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 @@ -78,6 +78,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 @@ -307,7 +307,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 @@ -289,7 +289,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 @@ -293,7 +293,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 @@ -208,7 +208,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 @@ -720,7 +720,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 @@ -752,7 +752,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 !== 'never') {
// 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 !== 'never') {
upgrade.prTitle = upgrade.prTitle.toLowerCase();
}
} else {
Expand Down