-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Commit messages should not be fully lowercased #12062
Comments
What specific text in the linked angular document are you referring to? |
From "Commit Message Format" > "Commit Message Header" > "Summary" |
We need to make sure our findPr function is case insensitive before we make this change. |
@RahulGautamSingh I see that #12025 is now merged. Were you able to fix this as part of that pull request? |
@Xavientois I am sorry for the delay. There is one folder The work is completed just the commit & push is remaining. Also it seems I linked the wrong PR, I meant that this issue will be closed with #11875 . |
export async function findPr({
branchName,
prTitle,
state = PrState.All,
}: FindPRConfig): Promise<Pr | null> {
let prsFiltered: Pr[] = [];
try {
const prs = await getPrList();
prsFiltered = prs.filter(
(item) => item.sourceRefName === getNewBranchName(branchName)
);
if (prTitle) {
prsFiltered = prsFiltered.filter((item) => item.title === prTitle);
}
switch (state) {
case PrState.All:
// no more filter needed, we can go further...
break;
case PrState.NotOpen:
prsFiltered = prsFiltered.filter((item) => item.state !== PrState.Open);
break;
default:
prsFiltered = prsFiltered.filter((item) => item.state === state);
break;
}
} catch (err) {
logger.error({ err }, 'findPr error');
}
if (prsFiltered.length === 0) {
return null;
}
return prsFiltered[0];
}
|
Isn't |
My bad. I guess we have to use |
Or a couple of couple of toLowerCase() |
renovate/lib/workers/repository/updates/generate.ts Lines 197 to 210 in a13da7e
Do we need to change this too? |
Depends where/why the lower case field is set. |
I think we might have change the renovate/lib/workers/repository/updates/generate.ts Lines 163 to 166 in 5a33033
|
So we need to get smarter than simply lower or not lower case |
if (upgrade.toLowerCase) {
const titleMessage = upgrade.prTitle.split(' ');
titleMessage[0] = titleMessage[0].toLowerCase();
upgrade.prTitle = titleMessage.join(' ');
upgrade.prTitle = upgrade.prTitle.toLowerCase();
}
} else {
[upgrade.prTitle] = upgrade.commitMessage.split('\n');
} === if (upgrade.toLowerCase) {
// We only need to lowercase the first line
const splitMessage = upgrade.commitMessage.split('\n');
let firstMessage: string[];
if (splitMessage.includes(':')) {
firstMessage = splitMessage[0].split(':')[1].split(' ');
} else {
firstMessage = splitMessage[0].split(' ');
}
firstMessage[0] = firstMessage[0].toLowerCase();
splitMessage[0] = firstMessage.join(' ');
splitMessage[0] = splitMessage[0].toLowerCase();
upgrade.commitMessage = splitMessage.join('\n');
} These are the changes I came up with. I am trying on a regex solution but the regex becomes to complex and uses lookarounds in it, which RE2 doesn't support. I ran into one problem while running build workflow on the updated files.
I tried looking into it last time but couldn't find a solution, could you please help me with solving this one?
|
Is the only reason we do lower casing for semantic commits? |
It seems so. To get more details we will have test it by opening a PR and then the check details in CodeCov site. |
It looks like |
New code:- if (upgrade.semanticCommitCasing) {
// We only need to lowercase the first word
const splitMessage = upgrade.commitMessage.split('\n');
splitMessage[0] = splitMessage[0].replace(
splitMessage[0].includes(':') ? regEx(/: \w+/) : regEx(/^\w+/),
(match) => match.toLowerCase()
);
upgrade.commitMessage = splitMessage.join('\n');
} if (upgrade.semanticCommitCasing) {
upgrade.prTitle = upgrade.prTitle.replace(regEx(/^\w+/), (match) =>
match.toLowerCase()
);
} |
Hey @rarkins , do you approve of this suggestion by @pret-a-porter ? |
Hi, We really need this feature. So if somebody can have a look at his, we would really appreciate it. I for myself will try, but don't expect too much, because I am more a Go/Rust guy ^^ |
we should review @pret-a-porter PR again, which then needs a lot real tests to not break things again. |
The Angular reference for the summary [1] demands "don't capitalize the first letter" and Renovate adheres to it (without making it configurable yet [2]), so only warn here in order to accept Renovate PRs. [1]: https://github.com/angular/angular/blob/main/CONTRIBUTING.md#summary [2]: renovatebot/renovate#12062 Signed-off-by: Sebastian Schuberth <[email protected]>
Hi there, Get your issue fixed faster by creating a minimal reproduction. This means a repository dedicated to reproducing this issue with the minimal dependencies and config possible. Before we start working on your issue we need to know exactly what's causing the current behavior. A minimal reproduction helps us with this. To get started, please read our guide on creating a minimal reproduction. We may close the issue if you, or someone else, haven't created a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment. Good luck, The Renovate team |
When a bug has been marked as needing a reproduction, it means nobody can work on it until one is provided. In cases where no reproduction is possible, or the issue creator does not have the time to reproduce, we unfortunately need to close such issues as they are non-actionable and serve no benefit by remaining open. This issue will be closed after 7 days of inactivity. |
This bug report has been closed as we need a reproduction to work on this. If the original poster or anybody else with the same problem discovers that they can reproduce it, please create a new issue, and reference this issue. |
How are you running Renovate?
WhiteSource Renovate hosted app on github.com
Please select which platform you are using if self-hosting.
No response
If you're self-hosting Renovate, tell us what version of Renovate you run.
No response
Describe the bug
When Renovate opens a PR with semantic commits the entire commit message/PR title is lowercased. This is unnecessary, only the first letter needs to be lowercased (per Angular commit guidelines, I think most other semantic commit specs do the same).
Given the title:
Actual behavior:
Expected:
Relevant code:
renovate/lib/workers/repository/updates/generate.ts
Lines 184 to 189 in 00e1917
Relevant debug logs
No response
Have you created a minimal reproduction repository?
No reproduction repository
The text was updated successfully, but these errors were encountered: