ci: lint_commit job fails when commit message is valid
Summary
The CI job lint_commit
fails
Example: https://gitlab.com/gitlab-org/cli/-/jobs/3344318195
Steps to reproduce
- Create an MR with a single commit and valid commit message (for example:
ci: just testing a test
) - Push MR
- Watch job
lint_commit
go🔴
What is the current bug behavior?
The CI job is failing even though the commit message is valid.
What is the expected correct behavior?
The CI job should pass
Relevant logs and/or screenshots
https://gitlab.com/gitlab-org/cli/-/jobs/3344318195
Workaround
The current workaround is to tick [x] Squash commits when merge request is accepted.
in the Merge options of the MR.
Possible fixes
From Slack:
I think it is caused by the “Merge Options -> Enable merged results pipelines” - It runs the pipeline on a “merge” commit with the GitLab-generated commit message.
That’s why “squashing” helps, the logic then ignores the two commits (one yours and one merge commit) and uses the MR title. But this would potentially result in a invalid commit message sneaking in.
Temporary workaround is going to be to allow commit messages starting with “Merge branch” prefix.