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

Function NewIssueState

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

Source from the content-addressed store, hash-verified

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