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

Method DeleteBranch

admin/github.go:159–174  ·  view source on GitHub ↗
(ctx context.Context, installationID, repoID int64, remote, branch string)

Source from the content-addressed store, hash-verified

157}
158
159func (g *githubClient) DeleteBranch(ctx context.Context, installationID, repoID int64, remote, branch string) error {
160 client := g.InstallationClient(installationID, &repoID)
161 org, repo, ok := gitutil.SplitGithubRemote(remote)
162 if !ok {
163 return fmt.Errorf("invalid Github remote %q", remote)
164 }
165 _, err := client.Git.DeleteRef(ctx, org, repo, "heads/"+branch)
166 if err != nil {
167 var ghErr *github.ErrorResponse
168 if errors.As(err, &ghErr) && (ghErr.Response.StatusCode == http.StatusNotFound || ghErr.Response.StatusCode == http.StatusUnprocessableEntity) {
169 return ErrBranchNotFound
170 }
171 return fmt.Errorf("failed to delete branch %q: %w", branch, err)
172 }
173 return nil
174}
175
176func (g *githubClient) CreateManagedRepo(ctx context.Context, name string, autoInit bool) (*github.Repository, error) {
177 repoName := fmt.Sprintf("%s-%v", name, uuid.New().String()[0:8])

Callers

nothing calls this directly

Calls 3

InstallationClientMethod · 0.95
SplitGithubRemoteFunction · 0.92
ErrorfMethod · 0.65

Tested by

no test coverage detected