Skip to content

Add check for Changelog on first commit on branch

Sanad Liaquat requested to merge shl-lefthook-for-changelog-on-first-commit into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Issues a warning in Lefthook if the first commit of the branch doesn't have a Changelog git trailer

This is mostly copied over from gitlab-org/ruby/gems/gitlab_quality-test_tooling!154 (merged)

Only change from that MR is the default branch which in the case of this project is master.

Related issue: gitlab-org/quality/quality-engineering/team-tasks#2500 (closed)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

git checkout lefthook_check_changelog
git checkout -b my-test-branch
git reset HEAD~1 # Remove the commit from the MR
git add .
git commit -m 'A commit without a changelog'
bundle exec lefthook run pre-push # should fail

git commit --amend

"""
A commit with a changelog

Changelog: added
"""

bundle exec lefthook run pre-push # should succeed

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sanad Liaquat

Merge request reports