Loading
Follow Conventional Commits in auto-remediation commits and titles
What does this MR do and why?
Projects that enforce commitlint reject auto-remediation commits and MR titles (type-empty, subject-empty). With squash merge the MR title becomes the default-branch commit, so both have to change.
| Before | After | |
|---|---|---|
| Conventional repo, MR title | Security: Update fast-uri from 3.0.6 to 3.1.8 |
build(deps): [security] update fast-uri from 3.0.6 to 3.1.8 |
| Conventional repo, commit subject | Update fast-uri |
same string as the MR title |
| Plain repo | unchanged | unchanged |
CommitConvention decides which style a repo uses from its recent history, the same way Renovate and Dependabot do:
| Renovate | Dependabot | This MR | |
|---|---|---|---|
| Sample | last 20 non-merge commits | recent commits, minus its own and merges | latest 20 non-merge commits not by the service account, from the last 50 |
| Threshold | more than half | at least 30% | at least 30% |
| Counts as conventional | any word before : |
the 10 standard types | the 10 standard types, at the start of the subject |
| Type written | chore unless configured |
chore or build, copied from history |
chore or build, copied from history |
| Type case | as configured | copied from history (Build(deps):) |
copied from history |
| Other prefix styles | counted as conventional (see above) | ESLint Upgrade:, gitmoji ⬆️, any word: gets build(deps): |
plain title |
A commitlint config file is not used as a signal. It can exist without being enforced, and teams enforce the style with other tools too.
Other details:
- An open MR keeps the style it was created with. A refresh doesn't re-read the history, so a conventional MR is never renamed back to plain. A plain MR still detects, so it can move to conventional.
- If the history read fails, the error is reported and the title falls back to plain.
from <old>is dropped when the title would exceed commitlint's 100-character header limit. If even the short form is over 100 characters, the title overflows, because truncating the name would lose the dismissal match. Body lines are wrapped at 100 in every repo.SINGLE_DEPENDENCY_REGEXparses both title formats, because the dismissal check reads closed MR titles, which keep their original format.- Behind the
dependency_management_conventional_commitsflag (gitlab_com_derisk). Only the style choice is gated.SINGLE_DEPENDENCY_REGEXparses both formats regardless, so turning the flag off keeps dismissals of conventional-titled MRs working.
References
- Closes #631539
- Feature flag rollout: #635262
- Using the project's merge request title pattern to pick the format: #634938 / !263711
- Reported from ai-assist !7171 and container-registry !2949
How to set up and validate locally
- In GDK, use an auto-remediation project whose default branch has a few commits like
feat: xandfix: y. Trigger a remediation. The MR title and commit subject should both bebuild(deps): [security] update <name> from <old> to <new>. - Close that MR and trigger again. It should not be recreated.
- In a project with plain history, the title and commit stay in today's format.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.
Edited by Albina Yusupova