diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-06-29 15:34:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 15:34:03 +0200 |
commit | aac663e0da0af644ae1011d268d027160265dce3 (patch) | |
tree | e2001118696d507561664349a27d7b9fca7d01ed /modules/notification/webhook/webhook.go | |
parent | 579fcad8cdd16e88edc60685fbf9b555266bac76 (diff) | |
download | gitea-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 'modules/notification/webhook/webhook.go')
-rw-r--r-- | modules/notification/webhook/webhook.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/notification/webhook/webhook.go b/modules/notification/webhook/webhook.go index 90dc59021c..acdb91efe3 100644 --- a/modules/notification/webhook/webhook.go +++ b/modules/notification/webhook/webhook.go @@ -562,7 +562,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { apiPusher := convert.ToUser(pusher, nil) - apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) + apiCommits, apiHeadCommit, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) if err != nil { log.Error("commits.ToAPIPayloadCommits failed: %v", err) return @@ -574,6 +574,7 @@ func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Re After: opts.NewCommitID, CompareURL: setting.AppURL + commits.CompareURL, Commits: apiCommits, + HeadCommit: apiHeadCommit, Repo: convert.ToRepo(repo, models.AccessModeOwner), Pusher: apiPusher, Sender: apiPusher, @@ -790,7 +791,7 @@ func (m *webhookNotifier) NotifyDeleteRelease(doer *models.User, rel *models.Rel func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { apiPusher := convert.ToUser(pusher, nil) - apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) + apiCommits, apiHeadCommit, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) if err != nil { log.Error("commits.ToAPIPayloadCommits failed: %v", err) return @@ -802,6 +803,7 @@ func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *model After: opts.NewCommitID, CompareURL: setting.AppURL + commits.CompareURL, Commits: apiCommits, + HeadCommit: apiHeadCommit, Repo: convert.ToRepo(repo, models.AccessModeOwner), Pusher: apiPusher, Sender: apiPusher, |