MCPcopy Index your code
hub / github.com/rilldata/rill / CreateGithubPullRequest

Method CreateGithubPullRequest

cli/pkg/local/git.go:115–145  ·  view source on GitHub ↗
(ctx context.Context, r *connect.Request[localv1.CreateGithubPullRequestRequest])

Source from the content-addressed store, hash-verified

113}
114
115func (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
147func (s *Server) GetGithubPullRequest(ctx context.Context, r *connect.Request[localv1.GetGithubPullRequestRequest]) (*connect.Response[localv1.GetGithubPullRequestResponse], error) {
148 if !s.app.ch.IsAuthenticated() {

Callers

nothing calls this directly

Calls 4

IsAuthenticatedMethod · 0.80
InferProjectsMethod · 0.80
ClientMethod · 0.45

Tested by

no test coverage detected