GsActions / commit-message-checker

GitHub Action that checks commit messages of pushes and pull request against a regex pattern
MIT License
99 stars 56 forks source link

Exclude merge commits from checks #75

Open ArjenVanDerWeijden opened 2 years ago

ArjenVanDerWeijden commented 2 years ago

Code of Conduct

Is there an existing issue for this?

Are you willing to sponsor your idea?

Is your feature request related to a problem? Please describe

We are trying to automate, checking whether commits match a regex - your action works great.

Unless it's a merge commit (e.g. locally a developer merged one branch into another, created a merge commit and pushed that).

The commit message will not match the desired regex.

Describe the solution you'd like

You can check if a commit is a merge commit:

git cat-file -p $commit_id

If there's more than one `parent' line in the output, you found a merge.

If there's a "ignoreMergeCommits" setting acitvated, then do not even test for the regex (just list it as 'ignored'?)

Describe alternatives you've considered

No response

Additional context

No response

codebydant commented 1 year ago

Hi @ArjenVanDerWeijden,

There are a couple of things here:

In any of these cases, what you can do is configure your repository settings to change the "merge commit" format.

Screenshot from 2023-05-17 06-16-00