(ctx context.Context, r *connect.Request[localv1.CreateGithubPullRequestRequest])
| 113 | } |
| 114 | |
| 115 | func (s *Server) CreateGithubPullRequest(ctx context.Context, r *connect.Request[localv1.CreateGithubPullRequestRequest]) (*connect.Response[localv1.CreateGithubPullRequestResponse], error) { |
| 116 | if !s.app.ch.IsAuthenticated() { |
| 117 | return nil, errors.New("must authenticate before performing this action") |
| 118 | } |
| 119 | |
| 120 | projects, err := s.app.ch.InferProjects(ctx, s.app.ch.Org, s.app.ProjectPath) |
| 121 | if err != nil { |
| 122 | return nil, err |
| 123 | } |
| 124 | project := projects[0] |
| 125 | |
| 126 | c, err := s.app.ch.Client() |
| 127 | if err != nil { |
| 128 | return nil, err |
| 129 | } |
| 130 | |
| 131 | resp, err := c.CreateGithubPullRequest(ctx, &adminv1.CreateGithubPullRequestRequest{ |
| 132 | Org: project.OrgName, |
| 133 | Project: project.Name, |
| 134 | Branch: r.Msg.Branch, |
| 135 | Title: r.Msg.Title, |
| 136 | Body: r.Msg.Body, |
| 137 | }) |
| 138 | if err != nil { |
| 139 | return nil, err |
| 140 | } |
| 141 | |
| 142 | return connect.NewResponse(&localv1.CreateGithubPullRequestResponse{ |
| 143 | PrUrl: resp.PrUrl, |
| 144 | }), nil |
| 145 | } |
| 146 | |
| 147 | func (s *Server) GetGithubPullRequest(ctx context.Context, r *connect.Request[localv1.GetGithubPullRequestRequest]) (*connect.Response[localv1.GetGithubPullRequestResponse], error) { |
| 148 | if !s.app.ch.IsAuthenticated() { |
nothing calls this directly
no test coverage detected