libp2p / libp2p/rust-libp2p

ci: rework commit message template

Open
#4,152 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.6k
Forks
1.3k
Avg merge
8h 47m
Merged PRs (30d)
19

Description

Once mergify exposes co-authorship as a first-class attribute (see https://github.com/Mergifyio/mergify/discussions/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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Jinja2 commit-message template and the pull-request template section described in the issue, then verify how git interpret-trailers treats blank lines and trailer placement. Done means the generated message always includes the pull-request trailer, keeps trailers on separate adjacent lines, and handles optional Resolves or Related trailers correctly after Mergify supports co-authorship.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.