How to recreate Github squash commit message Co-authored-by trailer with commit template? #4636
-
Hi all, My current config uses squash-and-merge action with custom commit message template to use PR title and body as commit message. The main reason for this is that commits added during the review process are useful snapshots for discussion but the PR itself should always be a single atomic unit of change that is defined by title and body. It's also much easier to change than the commit messages themselves without mutating git history. Github's default squash commit unfortunately concatenates all commit messges in this case which is dilutes the meaning of the PR. What is nice though is that Github pre-populates Co-authored-by tags with all the commit authors being squashed which preserves history and more accurately reflects the contributors to the final commit. From what I can tell, there's no commit author attribute to reference in the commit message template (like there is for approvers for example) but maybe I'm missing a way I can't see now. I think otherwise probably the best thing to do is to manually add Co-authored-by: to the body of the pull request manually when necessary. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 17 replies
-
We don't expose a list of all commit authors in the attribute, but I imagine that'd solve it. It'd be nice to have That's something to add on the roadmap for sure. :) |
Beta Was this translation helpful? Give feedback.
-
One thing to note is that I am currently testing the following template:
|
Beta Was this translation helpful? Give feedback.
-
This seems to now be implemented as I've found the following in the docs: https://docs.mergify.com/configuration/#data-type-commit-author Can you confirm that merge commits are excluded from that? |
Beta Was this translation helpful? Give feedback.
I think I was just able to simplify this down to: