Skip to content

Commit

Permalink
fix: ignore template flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nilvng committed Nov 6, 2024
1 parent 30066b0 commit a780b48
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/cmd/pr/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ func createRun(opts *CreateOptions) (err error) {
state.Title = opts.Title
state.Body = opts.Body
}
if opts.Template != "" {
state.Template = opts.Template
}
err = handlePush(*opts, *ctx)
if err != nil {
return
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/pr/shared/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func WithPrAndIssueQueryParams(client *api.Client, baseRepo ghrepo.Interface, ba
if len(state.Assignees) > 0 {
q.Set("assignees", strings.Join(state.Assignees, ","))
}
// Embded a template only if the body is empty, which is useful for Web Mode, and avoid duplication in Editor Mode
if len(state.Template) > 0 && len(state.Body) == 0 {
q.Set("template", state.Template)
}
if len(state.Labels) > 0 {
q.Set("labels", strings.Join(state.Labels, ","))
}
Expand All @@ -40,6 +44,7 @@ func WithPrAndIssueQueryParams(client *api.Client, baseRepo ghrepo.Interface, ba
if len(state.Milestones) > 0 {
q.Set("milestone", state.Milestones[0])
}

u.RawQuery = q.Encode()
return u.String(), nil
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/pr/shared/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type IssueMetadataState struct {
Body string
Title string

Template string

Metadata []string
Reviewers []string
Assignees []string
Expand Down

0 comments on commit a780b48

Please sign in to comment.