You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prepend commit bodies in gh pr create with templates #1570
Describe the feature or problem you’d like to solve
Currently, if a PR template exists in the project, that's all that goes into file when hitting e to "edit" the PR body. It'd be convenient if we could pull in commit bodies, since—especially for single-commit PRs—those bodies already have the explanation we would otherwise want to include in the PR. There is prior art in that I believe in the absence of a template, gh already does this as the only content. Furthermore, I believe that github's web interface will prepend a single-commit body to templates.
Proposed solution
Perhaps a flag like --prepend-commits-to-templates and/or --append-commits-to-templates? Or something less verbose.
Additional context
My company uses a PR template as a checklist. I've been enjoying using gh pr create with this, since Vim makes filling out the checklist very easy. However, if I want to include the commit body as context, it's quite a bit of extra work to grab that and include it.
I can confirm just now that a single-commit PR created on Github web prepends the commit body to the template. Having even just this behavior by default would be super convenient :)
I'm happy to take a community PR for this so it's up to the two of you who continues work on it.
This behavior makes sense to me as a default and I don't think a new flag is needed; thus, I think the next step is to just add test coverage to #1611 ?
Hey sorry didn't mean to step on anyone's toes, I just keep running into this issue!
I've added a quick test that verifies the behavior of including the "default" commit message, prepended in front of any selected template body. It took me a bit to try to understand how the existing tests work, but I think it follows all the existing conventions. Please let me know if you want tests for other cases.
Activity
mislav commentedon Aug 26, 2020
Thank you for the suggestion! I definitely agree that we should act more like GitHub.com web interface when it comes to templates.
utkarsh-khandelwal12 commentedon Aug 28, 2020
Hi
I have just started working with PR Templates and I do feel like this is a nice enhancement.
@mislav I would like to work on it.
dhleong commentedon Aug 28, 2020
I can confirm just now that a single-commit PR created on Github web prepends the commit body to the template. Having even just this behavior by default would be super convenient :)
utkarsh-khandelwal12 commentedon Aug 31, 2020
@mislav I would like to get an update
Prepend PR body defaults to the selected template (if any)
vilmibm commentedon Sep 1, 2020
hi @utkarsh-khandelwal12 , it looks like @dhleong has already started working on it.
I'm happy to take a community PR for this so it's up to the two of you who continues work on it.
This behavior makes sense to me as a default and I don't think a new flag is needed; thus, I think the next step is to just add test coverage to #1611 ?
dhleong commentedon Sep 2, 2020
Hey sorry didn't mean to step on anyone's toes, I just keep running into this issue!
I've added a quick test that verifies the behavior of including the "default" commit message, prepended in front of any selected template body. It took me a bit to try to understand how the existing tests work, but I think it follows all the existing conventions. Please let me know if you want tests for other cases.
Prepend PR body defaults to the selected template (if any)
mislav commentedon Sep 10, 2020
@dhleong Thank you for your contribution! Is there any functionality still missing or incomplete now that your PR has been merged?
dhleong commentedon Sep 10, 2020
Nope, I think it's best to keep it simple as-is. Thanks!