Allow editing commit subject when squash-merging a PR#3344
Conversation
pkg/cmd/pr/merge/http.go
Outdated
| if err != nil { | ||
| // Tolerate this API missing in older GitHub Enterprise | ||
| if strings.Contains(err.Error(), "Field 'viewerMergeHeadlineText' doesn't exist") { | ||
| return "", nil |
There was a problem hiding this comment.
Same as viewerMergeBodyText, the viewerMergeHeadlineText field might not be available in older GHE versions.
pkg/cmd/pr/merge/merge.go
Outdated
| cmd.Flags().BoolVarP(&opts.DeleteBranch, "delete-branch", "d", false, "Delete the local and remote branch after merge") | ||
| cmd.Flags().StringVarP(&opts.Body, "body", "b", "", "Body `text` for the merge commit") | ||
| cmd.Flags().StringVarP(&bodyFile, "body-file", "F", "", "Read body text from `file`") | ||
| cmd.Flags().StringVarP(&opts.Subject, "subject", "", "", "Subject `text` for the merge commit") |
There was a problem hiding this comment.
Should this be --title?
Since other gh commands already use it I decided to go with --subject but I think title is more descriptive.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
vilmibm
left a comment
There was a problem hiding this comment.
thanks for working on this, it's looking good!
I think it would be perfectly fine to allow this functionality on all the merge types -- just like the web UI.
pkg/cmd/pr/merge/merge.go
Outdated
| cmd.Flags().BoolVarP(&opts.DeleteBranch, "delete-branch", "d", false, "Delete the local and remote branch after merge") | ||
| cmd.Flags().StringVarP(&opts.Body, "body", "b", "", "Body `text` for the merge commit") | ||
| cmd.Flags().StringVarP(&bodyFile, "body-file", "F", "", "Read body text from `file`") | ||
| cmd.Flags().StringVarP(&opts.Subject, "subject", "", "", "Subject `text` for the merge commit") |
|
I & my team greatly miss this feature for our workflow, is there anything I can do to help this along? |
|
@mgabeler-lee-6rs will see if I can update this PR this weekend :) |
|
@cristiand391 Your current commit 6e5db7 from April 1st on the branch of this PR didn't work for me. I git describe --tags
v0.12.0-1076-g6e5db706
make install prefix=$HOME/.local
$HOME/.local/bin/gh pr merge --squash --auto --subject 'py-ipykernel: Add version 6.0.2 (#26501)' --body ''resulted in this commit: spack/spack@2cdfa33 /home/kaindlb/.local/bin/gh pr merge --squash --subject 'py-ipywidgets: Add version 7.6.3 (#26502)'
✓ Squashed and merged pull request #26502 (py-ipywidgets: Add version 7.6.3)Result: spack/spack@943f1e7 |
mislav
left a comment
There was a problem hiding this comment.
Thanks for your patience! I have resolved the merge with trunk, fixed the problem with --subject not being respected in non-interactive mode, and cleaned up the code a little bit.
Ref. #1023 (comment)
This PR adds support for editing the commit subject line when squash-merging a PR.