diff options
author | Jason Song <i@wolfogre.com> | 2022-09-04 17:18:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-04 12:18:07 +0300 |
commit | 93a610a819688b54d4565b8cbbae7cc04c552073 (patch) | |
tree | 21fa5f55d958aa01eab6e6e370c02c6bc45ca869 /routers/web | |
parent | 0887459ac68a7d3605ba0f4a51df97b76e7cae9e (diff) | |
download | gitea-93a610a819688b54d4565b8cbbae7cc04c552073.tar.gz gitea-93a610a819688b54d4565b8cbbae7cc04c552073.zip |
Fill the specified ref in webhook test payload (#20961)
The webhook payload should use the right ref when it‘s specified in the testing request.
The compare URL should not be empty, a URL like `compare/A...A` seems useless in most cases but is helpful when testing.
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/repo/webhook.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/routers/web/repo/webhook.go b/routers/web/repo/webhook.go index a5270a7761..7e659de0da 100644 --- a/routers/web/repo/webhook.go +++ b/routers/web/repo/webhook.go @@ -665,10 +665,12 @@ func TestWebhook(ctx *context.Context) { }, } + commitID := commit.ID.String() p := &api.PushPayload{ Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch, - Before: commit.ID.String(), - After: commit.ID.String(), + Before: commitID, + After: commitID, + CompareURL: setting.AppURL + ctx.Repo.Repository.ComposeCompareURL(commitID, commitID), Commits: []*api.PayloadCommit{apiCommit}, HeadCommit: apiCommit, Repo: convert.ToRepo(ctx.Repo.Repository, perm.AccessModeNone), |