diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-11-06 22:41:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-07 06:41:49 +0000 |
commit | 331e878e81d57235a53199383087c7649797a887 (patch) | |
tree | 736485bdb5b49956022587506315b652076cff2f /modules/repository | |
parent | 145e26698791221b007c7dd460fb506cb0237235 (diff) | |
download | gitea-331e878e81d57235a53199383087c7649797a887.tar.gz gitea-331e878e81d57235a53199383087c7649797a887.zip |
Add new event commit status creation and webhook implementation (#27151)
This PR introduces a new event which is similar as Github's. When a new
commit status submitted, the event will be trigged. That means, now we
can receive all feedback from CI/CD system in webhooks or other notify
systems.
ref:
https://docs.github.com/en/webhooks/webhook-events-and-payloads#status
Fix #20749
Diffstat (limited to 'modules/repository')
-rw-r--r-- | modules/repository/commits.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/repository/commits.go b/modules/repository/commits.go index ede60429a1..6e4b75d5ca 100644 --- a/modules/repository/commits.go +++ b/modules/repository/commits.go @@ -42,8 +42,8 @@ func NewPushCommits() *PushCommits { return &PushCommits{} } -// toAPIPayloadCommit converts a single PushCommit to an api.PayloadCommit object. -func (pc *PushCommits) toAPIPayloadCommit(ctx context.Context, emailUsers map[string]*user_model.User, repoPath, repoLink string, commit *PushCommit) (*api.PayloadCommit, error) { +// ToAPIPayloadCommit converts a single PushCommit to an api.PayloadCommit object. +func ToAPIPayloadCommit(ctx context.Context, emailUsers map[string]*user_model.User, repoPath, repoLink string, commit *PushCommit) (*api.PayloadCommit, error) { var err error authorUsername := "" author, ok := emailUsers[commit.AuthorEmail] @@ -105,7 +105,7 @@ func (pc *PushCommits) ToAPIPayloadCommits(ctx context.Context, repoPath, repoLi emailUsers := make(map[string]*user_model.User) for i, commit := range pc.Commits { - apiCommit, err := pc.toAPIPayloadCommit(ctx, emailUsers, repoPath, repoLink, commit) + apiCommit, err := ToAPIPayloadCommit(ctx, emailUsers, repoPath, repoLink, commit) if err != nil { return nil, nil, err } @@ -117,7 +117,7 @@ func (pc *PushCommits) ToAPIPayloadCommits(ctx context.Context, repoPath, repoLi } if pc.HeadCommit != nil && headCommit == nil { var err error - headCommit, err = pc.toAPIPayloadCommit(ctx, emailUsers, repoPath, repoLink, pc.HeadCommit) + headCommit, err = ToAPIPayloadCommit(ctx, emailUsers, repoPath, repoLink, pc.HeadCommit) if err != nil { return nil, nil, err } |