1
0
mirror of https://codeberg.org/crowci/crow.git synced 2025-08-12 06:02:53 +03:00
qwerty287
2024-02-11 10:44:50 +01:00
committed by GitHub
parent 894ab51215
commit e1521ef460
16 changed files with 92 additions and 46 deletions

View File

@@ -565,13 +565,16 @@ func (c *client) Branches(ctx context.Context, u *model.User, r *model.Repo, p *
}
// BranchHead returns the sha of the head (latest commit) of the specified branch
func (c *client) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (string, error) {
func (c *client) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error) {
token := common.UserToken(ctx, r, u)
b, _, err := c.newClientToken(ctx, token).Repositories.GetBranch(ctx, r.Owner, r.Name, branch, 1)
if err != nil {
return "", err
return nil, err
}
return b.GetCommit().GetSHA(), nil
return &model.Commit{
SHA: b.GetCommit().GetSHA(),
ForgeURL: b.GetCommit().GetHTMLURL(),
}, nil
}
// Hook parses the post-commit hook from the Request body