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 commit undetected #11

Open
ewjoachim opened this issue May 13, 2020 · 0 comments
Open

Merge commit undetected #11

ewjoachim opened this issue May 13, 2020 · 0 comments

Comments

@ewjoachim
Copy link

ewjoachim commented May 13, 2020

The tools doesn't manage to detect some merge commits, leading to omissions and errors

Current behavior

This commit is not recognized as a merge commit, which leads to:

Traceback (most recent call last):
  File ".../bin/changelog", line 8, in <module>
    sys.exit(main())
  File ".../lib/python3.7/site-packages/changelog/__init__.py", line 233, in main
    changelog = generate_changelog(**vars(args))
  File ".../lib/python3.7/site-packages/changelog/__init__.py", line 196, in generate_changelog
    prs = fetch_changes(github_config, owner, repo, previous_tag, current_tag)
  File ".../lib/python3.7/site-packages/changelog/__init__.py", line 166, in fetch_changes
    branch))
Exception: Lots of commits and no PRs on branch master

Expected behavior

This commit should be recognized

Steps to replicate behavior (include URLs)

Run changelog peopledoc septentrion (as of today. Not sure it will last)
Alternative: clone https://github.com/peopledoc/septentrion, delete all commits after 138f7489abb4b05eb0383bc6e5e083359515d943 push, and run on the resulting repo

Screenshots

See traceback above

Leads

As far as I can tell, it's not detected because of the lack of 2 newlines following the standard message. I have no idea why GitHub decided not to put those new lines, but I suspect it's because my branch name was too long. You're welcome to try and see if you can reproduce with a long branch name.

So looking at the code, I see that detecting a merge commit is based on its message. This is likely to often break. The merge commit message is completely arbitrary and can be changed manually. A much stronger approach could be, e.g., to select commits with multiple parents (https://developer.github.com/v3/repos/commits/). Then we could match the pull requests using the pulls api (sadly there's no filter on merge commit sha).

Another approach could be using the graphql api (https://github.community/t5/GitHub-API-Development-and/Get-pull-request-associated-with-a-commit/td-p/16434) but it needs a token, anonymous graphql is not authorized.

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

No branches or pull requests

1 participant