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