Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude merge commits from checks #75

Open
2 of 3 tasks
ArjenVanDerWeijden opened this issue May 30, 2022 · 1 comment · May be fixed by #79
Open
2 of 3 tasks

Exclude merge commits from checks #75

ArjenVanDerWeijden opened this issue May 30, 2022 · 1 comment · May be fixed by #79
Assignees
Labels
enhancement New feature or request

Comments

@ArjenVanDerWeijden
Copy link

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Are you willing to sponsor your idea?

  • Yes, I like to sponsor this request

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

@dtcMLOps
Copy link

Hi @ArjenVanDerWeijden,

There are a couple of things here:

  • If you are merging the main branch onto your feature branch that will create the merge commit in your pull request and the action will fail the check. In this scenario you should use rebase instead merge to update a branch because you are introducing an unwanted commit in your history.
  • If the merge commit is generated after you merge a branch, the action should not fail unless you run the action for "merged pull requests" and "open pull requests".

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants