Skip to content

ci: fix the commit-lint script to reflect new squash logic

Tomas Vik requested to merge fix-commit-lint into main

In %13.11 GitLab changed how MR squash commit message gets generated: gitlab!55216 (merged).

TLDR; we simplified the logic to always use MR title if we are squashing multiple commits.

This change is reflected in GitLab documentation: https://docs.gitlab.com/ee/user/project/merge_requests/squash_and_merge.html#overview

This change invalidates one scenario ("Is there at least one multiline commit?") checked by the commit-lint script.

I found this issue because !270 (merged) ended up having "399 - expand glob pattern for gitlab-ci.yml file" squashed commit message instead of the expected first multiline commit:

feat(editor): extend autocomplete glob pattern

This will expand the glob pattern used in the
registerCompletionItemProvider call to allow for additional pipeline
file names to be used.

Closes issue #399 

Logic before

graph TD
A{Is MR set to be squashed?} --no--> B[Every commit must be valid]
A --yes--> C{Is there at least one multiline commit?}
C --no--> D[MR title must be valid]
C --yes--> E[First multiline commit must be valid]

Logic after

graph TD
A{Are there multiple commits?} --no--> B[Commit must be valid]
A --yes--> C
C{Is MR set to be squashed?} --no--> D[Every commit must be valid]
C --yes--> E[MR title must be valid]
Edited by Tomas Vik

Merge request reports