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

Merge commits are failing length check #110

Closed
statuscake-machine opened this issue Dec 31, 2022 · 6 comments · Fixed by #124
Closed

Merge commits are failing length check #110

statuscake-machine opened this issue Dec 31, 2022 · 6 comments · Fixed by #124

Comments

@statuscake-machine
Copy link

When a pull request is merged it will contain a subject message similar to the following:

Merge pull request #117 from Organisaiton/name-of-the-branch-being-merged

This is longer than the default 50 character limit. When the action runs on the main branch it fails.

@mristin
Copy link
Owner

mristin commented Dec 31, 2022

Hi @statuscake-machine

Should we just ignore messages starting with Merge pull request #.* from .*?

@statuscake-machine
Copy link
Author

I think that makes sense as these are outside the control of the user. Alternatively perhaps there is a way to detect if the commit was a merge commit? I'm not sure exactly the range of values that come from github.context.eventName but maybe merge is one of them?

@Fryuni
Copy link
Contributor

Fryuni commented Nov 16, 2023

Update on this. There is no way to detect for sure that a commit is a merge commit from just the event.

It is possible by making some API calls. For each commit in the push event we'd need to:

  1. Make a request asking which PR introduced that commit1
  2. Check if the commit in question is the same as the merge_commit_sha of the PR
  3. Check if the merge method was not a rebase merge, in which that value is just the last commit of the PR since there are no merge commits2

Footnotes

  1. List pull requests associated with a commit

  2. Pull request

@Fryuni
Copy link
Contributor

Fryuni commented Nov 16, 2023

A more generic approach would be to have a parameter to ignore commits whose title matches the given patterns. The default patterns for such a filter could be for matching GitHub's default merge commit title.

@mristin
Copy link
Owner

mristin commented Nov 17, 2023

@Fryuni I think the pattern matching approach is far simpler and would generalize across Git repositories.

@Fryuni
Copy link
Contributor

Fryuni commented Dec 7, 2023

It took me a while to get back to this, but PR is open now. Also, @mristin, I think you can send the command for the dependabot's PRs to re-evaluate and close themselves since everything was updated on a single PR

mristin pushed a commit that referenced this issue Dec 26, 2023
There was already logic to ignore merge commits,
but it was using a very restricted regular expression.

This PR:
- Improve the existing merge commit detection.
- Allow users to disable merge commit detection.
- Allow users to provide custom patterns to ignore

Related issues:
- Closes #110 

Signed-off-by: Luiz Ferraz <luiz@lferraz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants