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