chdsbd / kodiak

🔮 A bot to automatically update and merge GitHub PRs

Home Page:https://kodiakhq.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exclude kodiak and other merge users from co-authors

gharlan opened this issue · comments

It seems that if kodiak has updated a pr and if include_coauthors is activated, kodiak becomes a co-author. Example
I think it should be excluded from the co-author list.

Or maybe exclude all [bot] users?

Or maybe exclude all merge commits?
If I click on the "Update branch" button on github, I become the author of the merge commit.
I have not tested it, but I suspect that I would become a co-author then, too.

I have not tested it, but I suspect that I would become a co-author then, too.

I have tested it now, and yes, the user who clicked Update branch in a pr, becomes a co-author.

Excluding Kodiak from coauthors should be a simple change. We'd need to update this code to exclude Kodiak.

if (
commit_author.databaseId is None
# don't add trailers for pull request author.
# TODO(chdsbd): Should we remove this?
or commit_author.databaseId == pull_request.author.databaseId
):
continue

It seems like filtering out all merge commits is a little more complicated. One solution I think is to fetch parents.totalCount for each commit and exclude commits with more than one parent.

Commit API object: https://docs.github.com/en/free-pro-team@latest/graphql/reference/objects#commit

#581 has been deployed which should resolve this issue by ignoring merge commits for coauthors. Let me know if you run into any issues.

Thanks for the quick fixes. 👍