Skip to content

Commit cc62df1

Browse files
authored
Adds support for overriding PullTitle and PullBody (#33)
1 parent 2ab7f67 commit cc62df1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cmd/patch2pr/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type Options struct {
3737
Repository *patch2pr.Repository
3838
GitHubToken string
3939
GitHubURL *url.URL
40+
PullBody string
4041
}
4142

4243
func main() {
@@ -55,6 +56,7 @@ func main() {
5556
fs.StringVar(&opts.Message, "message", "", "message")
5657
fs.BoolVar(&opts.NoPullRequest, "no-pull-request", false, "no-pull-request")
5758
fs.StringVar(&opts.PatchBase, "patch-base", "", "patch-base")
59+
fs.StringVar(&opts.PullBody, "pull-body", "", "pull-body")
5860
fs.StringVar(&opts.PullTitle, "pull-title", "", "pull-title")
5961
fs.Var(RepositoryValue{&opts.Repository}, "repository", "repository")
6062
fs.StringVar(&opts.GitHubToken, "token", "", "token")
@@ -210,6 +212,14 @@ func execute(ctx context.Context, client *github.Client, patchFile string, opts
210212
title, body = splitMessage(newCommit.GetMessage())
211213
}
212214

215+
if opts.PullTitle != "" {
216+
title = opts.PullTitle
217+
}
218+
219+
if opts.PullBody != "" {
220+
body = opts.PullBody
221+
}
222+
213223
if pr, err = ref.PullRequest(ctx, &github.NewPullRequest{
214224
Title: &title,
215225
Body: &body,

0 commit comments

Comments
 (0)