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

ci: rework commit message template #4152

Open
thomaseizinger opened this issue Jul 3, 2023 · 1 comment
Open

ci: rework commit message template #4152

thomaseizinger opened this issue Jul 3, 2023 · 1 comment

Comments

@thomaseizinger
Copy link
Contributor

Once mergify exposes co-authorship as a first-class attribute (see Mergifyio/mergify#5091), we should work on our commit message template again.

In particular, we have the following requirements:

  1. There must not be any empty lines between any of the trailers for git interpret-trailers to work correctly.
  2. Each trailer must be on a separate line.

This presents a bit of a challenge that I'd like to document here. For one, to save on characters in the commit message title, we want to link to the pull-request via a trailer, like so: Pull-request: #XYZ. This would be error-prone to do manually so this should done automatically in the template. As a result, we will always have at least one trailer!

To automatically close issues or link to related ones, we often use the Resolves: #XYZ or Related: #XYZ trailer. Here comes the tricky bit:

  • Trailers need to be separated with a newline from the main message body, otherwise they are not considered trailers but just regular lines of the commit message.
  • We do not always have a a Resolved or Related trailer.

Can we write a Jinja2 template that always correctly generates the trailers? I think we might have to create a separate section in our pull-request template for handwritten trailers. This section would be inserted without newlines in the commit message whereas the main ## Description section would be unconditionally separated with a newline from the trailers.

@thomaseizinger
Copy link
Contributor Author

This seems to now be implemented: https://docs.mergify.com/configuration/#data-type-commit-author

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