Background
Currently, our ti-chi-bot will use the title of the PR as the message title of the commit generated after the squash merge, we can know this commit comes from which PR
However, because we maintain multiple release branches at the same time, PRs that fix the same problem have different PR numbers on different branches. We can’t directly know whether an issue has been fixed in the corresponding release branch through an issue number.
Content
So we propose that add the issue number to the PR title and check it when PR be opened so that we can easily query whether an issue has been fixed on a release branch through git log
.
We can use the same issue to introduce in detail which problems the associated PR has solved, which new features have been implemented, and which modifications have been made so that we can get a better release note when we release a new version.
-
If an issue needs to submit multiple PRs to fix, the titles of these PRs can all be associated with this issue number
-
In multiple release branches, PRs that fix the same issue can be associated with the same issue number
-
For a PR to resolve the issue of another repository, it is recommended to create a new issue in the current repository, and make it one of the subtasks of the original issue
To be discussed
Question: What is the new PR Title Format?
Option 1:
The new title format of the PR can be as follows, enclose the associated issue number with a pair of [
and ]
symbols and put it behind the title.
pkg: what's changed in this one package [123, 124]
After squash merge, the commit message will be:
pkg: what's changed in this one package [123, 124] (#14232)
The pattern of check regex can be: https://regex101.com/r/44eVG5/1
^.+: .{10,160}\s*\[[1-9]\d*(,\s*([1-9]\d*))*\]$
Option 2:
[issue-11123][issue-11124] pkg: what's changed in this one package
After squash merge, the commit message will be:
[issue-11123][issue-11124] pkg: what's changed in this one package (#14232)
Notice: This format will take up more length, especially when a PR references multiple issues.
Option 3:
[TI-11123][TI-11124] pkg: what's changed in this one package
After squash merge, the commit message will be:
[TI-11123][TI-11124] pkg: what's changed in this one package (#14232)
The regex can be: https://regex101.com/r/U6Hvcg/1
^(\[TI-[1-9]\d*\])+.+: .{10,160}$
Option 4:
[#11123][#11124] pkg: what's changed in this one package
After squash merge, the commit message will be:
[#11123][#11124] pkg: what's changed in this one package (#14232)
Notice: his format causes the commit to reference the issue.
Question: Should all the PR have associated issues and fill in the issue number to the title?
The current suggestion is that all the PR should be associated with at least one issue, because even some fix typo issues may have a larger impact, we also need to consider showing them on the release note.
Implementation plan
- Reach consensus on the problem about PR title associate issue number
- Modify the repository‘s PR template and CI Title Checker’s prompts, to make sure the newly opened PR gradually switch to the new title format
- After a period of implementation, we will modify the regular expression of the title checker to make sure the title of subsequent PR is correct.
cc: @tison, @zhouqiang-cl, @zhangyangyu
Suggestions are welcome!