gh
gh copied to clipboard
Plugins should be able to update the pull request title before it's submitted
Currently, I get a good amount of pulls from people using node-gh, as well as using the gh-jira plugin. To be honest, using the last git commit message is totally useless for anything except a single commit pull. Looking at the code, it doesn't look like (and I could have missed it) it allows a plugin to set the pull request title, and it would be useful for something like the gh-jira plugin to set the title to the title of the JIRA issue instead of the default one.
What about, instead of doing something with plugins, if your default editor opens to allow you to edit the pull request title and description? Is that good enough for you?
As of today I think a plugin can set any option if a command of it was called during the hook's 'before' step, but it's a lousy and you can't really rely on it.
So, I think there are two issues with that approach:
- It requires manual intervention for something that could be automated
- No one would ever actually use it, and it will instead keep defaulting back to the "useless 90% of the time" last commit approach.
I suppose I was thinking that the hooks for gh would allow (not sure if they do this currently) the plugins to mutate it's data, and asynchronously allow it to update it's state with either the before/after hooks.
Of course, I'm not insanely familiar with the plugin system, but I imagine being able to stream the data through the plugins would be nice. Just thinking out loud though :)
@natecavanaugh I'm resurrecting this discussion ha!
If I understand you correctly, you are suggesting to allow gh-jira to add a better default PR title?
I do see the value in automating it as I do that personally through a zsh function.
function gpr(){
if [ -z "$3" ]; then
prTitle=$(git_current_branch)
else
prTitle=$3
fi
gh pr -s $1 -b $2 -t $prTitle -D "Hey @$1 $4, here is the work for [$prTitle](https://issues.liferay.com/browse/$prTitle) :rocket:. Thanks for reviewing :relieved: $5"
}
Maybe a simpler solution would be just to list that example in the docs?