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

Method fetchReposForInstallation

admin/server/github.go:1111–1148  ·  view source on GitHub ↗
(ctx context.Context, client *github.Client, instID int64)

Source from the content-addressed store, hash-verified

1109}
1110
1111func (s *Server) fetchReposForInstallation(ctx context.Context, client *github.Client, instID int64) ([]*adminv1.ListGithubUserReposResponse_Repo, error) {
1112 repos := make([]*adminv1.ListGithubUserReposResponse_Repo, 0)
1113 page := 1
1114
1115 for {
1116 reposResp, httpResp, err := client.Apps.ListUserRepos(ctx, instID, &github.ListOptions{Page: page, PerPage: 100})
1117 if err != nil {
1118 return nil, err
1119 }
1120
1121 for _, repo := range reposResp.Repositories {
1122 var owner string
1123 if repo.Owner != nil {
1124 owner = fromStringPtr(repo.Owner.Login)
1125 }
1126 var branch string
1127 if repo.DefaultBranch != nil {
1128 branch = fromStringPtr(repo.DefaultBranch)
1129 } else {
1130 branch = fromStringPtr(repo.MasterBranch)
1131 }
1132 repos = append(repos, &adminv1.ListGithubUserReposResponse_Repo{
1133 Name: fromStringPtr(repo.Name),
1134 Owner: owner,
1135 Description: fromStringPtr(repo.Description),
1136 Remote: fromStringPtr(repo.CloneURL),
1137 DefaultBranch: branch,
1138 })
1139 }
1140
1141 if httpResp.NextPage == 0 {
1142 break
1143 }
1144 page = httpResp.NextPage
1145 }
1146
1147 return repos, nil
1148}
1149
1150func (s *Server) createRepo(ctx context.Context, remote, branch string, user *database.User) (string, error) {
1151 org, repo, ok := gitutil.SplitGithubRemote(remote)

Callers 1

fetchReposForUserMethod · 0.95

Calls 1

fromStringPtrFunction · 0.85

Tested by

no test coverage detected