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

Method ListGithubUserRepos

admin/server/github.go:219–252  ·  view source on GitHub ↗
(ctx context.Context, req *adminv1.ListGithubUserReposRequest)

Source from the content-addressed store, hash-verified

217}
218
219func (s *Server) ListGithubUserRepos(ctx context.Context, req *adminv1.ListGithubUserReposRequest) (*adminv1.ListGithubUserReposResponse, error) {
220 claims := auth.GetClaims(ctx)
221 if claims.OwnerType() != auth.OwnerTypeUser {
222 return nil, status.Error(codes.Unauthenticated, "not authenticated")
223 }
224
225 userID := claims.OwnerID()
226 user, err := s.admin.DB.FindUser(ctx, userID)
227 if err != nil {
228 return nil, err
229 }
230
231 // user has not authorized github app
232 if user.GithubUsername == "" {
233 return nil, status.Error(codes.Unauthenticated, "not authenticated")
234 }
235
236 token, err := s.userAccessToken(ctx, user)
237 if err != nil {
238 return nil, err
239 }
240
241 client := github.NewTokenClient(ctx, token)
242
243 // use a client with user's token to get installations
244 repos, err := s.fetchReposForUser(ctx, client)
245 if err != nil {
246 return nil, err
247 }
248
249 return &adminv1.ListGithubUserReposResponse{
250 Repos: repos,
251 }, nil
252}
253
254// CreateGithubPullRequest creates a Github PR from the specified branch to the project's primary branch.
255func (s *Server) CreateGithubPullRequest(ctx context.Context, req *adminv1.CreateGithubPullRequestRequest) (*adminv1.CreateGithubPullRequestResponse, error) {

Callers

nothing calls this directly

Calls 7

userAccessTokenMethod · 0.95
fetchReposForUserMethod · 0.95
GetClaimsFunction · 0.92
OwnerTypeMethod · 0.65
OwnerIDMethod · 0.65
FindUserMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected