(ctx CreateContext, opts CreateOptions, apiActorsSupported bool)
| 673 | } |
| 674 | |
| 675 | func NewIssueState(ctx CreateContext, opts CreateOptions, apiActorsSupported bool) (*shared.IssueMetadataState, error) { |
| 676 | var milestoneTitles []string |
| 677 | if opts.Milestone != "" { |
| 678 | milestoneTitles = []string{opts.Milestone} |
| 679 | } |
| 680 | |
| 681 | assigneeReplacer := shared.NewSpecialAssigneeReplacer(ctx.Client, ctx.PRRefs.BaseRepo().RepoHost(), apiActorsSupported, !opts.WebMode) |
| 682 | assignees, err := assigneeReplacer.ReplaceSlice(opts.Assignees) |
| 683 | if err != nil { |
| 684 | return nil, err |
| 685 | } |
| 686 | |
| 687 | copilotReplacer := shared.NewCopilotReviewerReplacer() |
| 688 | reviewers := copilotReplacer.ReplaceSlice(opts.Reviewers) |
| 689 | |
| 690 | state := &shared.IssueMetadataState{ |
| 691 | Type: shared.PRMetadata, |
| 692 | Reviewers: reviewers, |
| 693 | Assignees: assignees, |
| 694 | Labels: opts.Labels, |
| 695 | ProjectTitles: opts.Projects, |
| 696 | Milestones: milestoneTitles, |
| 697 | Draft: opts.IsDraft, |
| 698 | } |
| 699 | |
| 700 | if opts.FillVerbose || opts.Autofill || opts.FillFirst || !opts.TitleProvided || !opts.BodyProvided { |
| 701 | err := initDefaultTitleBody(ctx, state, opts.FillFirst, opts.FillVerbose) |
| 702 | if err != nil && (opts.FillVerbose || opts.Autofill || opts.FillFirst) { |
| 703 | return nil, fmt.Errorf("could not compute title or body defaults: %w", err) |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | return state, nil |
| 708 | } |
| 709 | |
| 710 | func NewCreateContext(opts *CreateOptions) (*CreateContext, error) { |
| 711 | httpClient, err := opts.HttpClient() |
no test coverage detected