MCPcopy Create free account
hub / github.com/cli/cli / NewIssueState

Function NewIssueState

pkg/cmd/pr/create/create.go:737–770  ·  view source on GitHub ↗
(ctx CreateContext, opts CreateOptions, apiActorsSupported bool)

Source from the content-addressed store, hash-verified

735}
736
737func NewIssueState(ctx CreateContext, opts CreateOptions, apiActorsSupported bool) (*shared.IssueMetadataState, error) {
738 var milestoneTitles []string
739 if opts.Milestone != "" {
740 milestoneTitles = []string{opts.Milestone}
741 }
742
743 assigneeReplacer := shared.NewSpecialAssigneeReplacer(ctx.Client, ctx.PRRefs.BaseRepo().RepoHost(), apiActorsSupported, !opts.WebMode)
744 assignees, err := assigneeReplacer.ReplaceSlice(opts.Assignees)
745 if err != nil {
746 return nil, err
747 }
748
749 copilotReplacer := shared.NewCopilotReviewerReplacer()
750 reviewers := copilotReplacer.ReplaceSlice(opts.Reviewers)
751
752 state := &shared.IssueMetadataState{
753 Type: shared.PRMetadata,
754 Reviewers: reviewers,
755 Assignees: assignees,
756 Labels: opts.Labels,
757 ProjectTitles: opts.Projects,
758 Milestones: milestoneTitles,
759 Draft: opts.IsDraft,
760 }
761
762 if opts.FillVerbose || opts.Autofill || opts.FillFirst || !opts.TitleProvided || !opts.BodyProvided {
763 err := initDefaultTitleBody(ctx, state, opts.FillFirst, opts.FillVerbose)
764 if err != nil && (opts.FillVerbose || opts.Autofill || opts.FillFirst) {
765 return nil, fmt.Errorf("could not compute title or body defaults: %w", err)
766 }
767 }
768
769 return state, nil
770}
771
772func NewCreateContext(opts *CreateOptions) (*CreateContext, error) {
773 httpClient, err := opts.HttpClient()

Callers 1

createRunFunction · 0.85

Calls 8

ReplaceSliceMethod · 0.95
initDefaultTitleBodyFunction · 0.85
RepoHostMethod · 0.65
BaseRepoMethod · 0.65
ErrorfMethod · 0.65
ReplaceSliceMethod · 0.45

Tested by

no test coverage detected