feat(tools): branch_delete

This commit is contained in:
Mathias Bergqvist
2026-05-06 22:42:38 +02:00
parent 06882d185e
commit 9e4251c1a7
4 changed files with 150 additions and 0 deletions

View File

@@ -114,6 +114,15 @@ func (c *Client) ListBranches(ctx context.Context, owner, repo string, page, lim
return branches, nil
}
func (c *Client) DeleteBranch(ctx context.Context, owner, repo, branch string) error {
p := fmt.Sprintf("/api/v1/repos/%s/%s/branches/%s", owner, repo, branch)
body, status, err := c.DeleteJSON(ctx, p)
if err != nil {
return err
}
return MapStatus(status, body)
}
// UpsertFile creates a file when args.Sha is empty (POST) or updates an existing
// file when args.Sha is set (PUT). Gitea routes both operations by HTTP method on
// the same /contents/{path} URL, and rejects PUT without a sha.