aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-06-29 15:34:03 +0200
committerGitHub <noreply@github.com>2021-06-29 15:34:03 +0200
commitaac663e0da0af644ae1011d268d027160265dce3 (patch)
treee2001118696d507561664349a27d7b9fca7d01ed /routers/api
parent579fcad8cdd16e88edc60685fbf9b555266bac76 (diff)
downloadgitea-aac663e0da0af644ae1011d268d027160265dce3.tar.gz
gitea-aac663e0da0af644ae1011d268d027160265dce3.zip
Implemented head_commit for webhooks (#16282)
* Removed Len field. * Added head_commit webhook field. * Added comment for returns.
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/hook.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index 5a0911544a..da0a2c501c 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -140,16 +140,17 @@ func TestHook(ctx *context.APIContext) {
return
}
+ commit := convert.ToPayloadCommit(ctx.Repo.Repository, ctx.Repo.Commit)
+
if err := webhook.PrepareWebhook(hook, ctx.Repo.Repository, models.HookEventPush, &api.PushPayload{
- Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch,
- Before: ctx.Repo.Commit.ID.String(),
- After: ctx.Repo.Commit.ID.String(),
- Commits: []*api.PayloadCommit{
- convert.ToPayloadCommit(ctx.Repo.Repository, ctx.Repo.Commit),
- },
- Repo: convert.ToRepo(ctx.Repo.Repository, models.AccessModeNone),
- Pusher: convert.ToUserWithAccessMode(ctx.User, models.AccessModeNone),
- Sender: convert.ToUserWithAccessMode(ctx.User, models.AccessModeNone),
+ Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch,
+ Before: ctx.Repo.Commit.ID.String(),
+ After: ctx.Repo.Commit.ID.String(),
+ Commits: []*api.PayloadCommit{commit},
+ HeadCommit: commit,
+ Repo: convert.ToRepo(ctx.Repo.Repository, models.AccessModeNone),
+ Pusher: convert.ToUserWithAccessMode(ctx.User, models.AccessModeNone),
+ Sender: convert.ToUserWithAccessMode(ctx.User, models.AccessModeNone),
}); err != nil {
ctx.Error(http.StatusInternalServerError, "PrepareWebhook: ", err)
return