Skip to content

Commit 023e61e

Browse files
authored
Create commit status when event is pull_request_sync (#23683)
Fix: #23674 If the type of `hook_event` is `pull_request_sync`, also need to insert a record of `commit_status` into DB. Because `pull_request` event and `pull_request_sync` event have the same payload, so the code is reusable. Screenshot: ![image](https://user-images.githubusercontent.com/33891828/227465436-1b436807-d0b2-4a2b-8890-09d96c7f666d.png)
1 parent aa3c673 commit 023e61e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

models/actions/run.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (run *ActionRun) GetPushEventPayload() (*api.PushPayload, error) {
129129
}
130130

131131
func (run *ActionRun) GetPullRequestEventPayload() (*api.PullRequestPayload, error) {
132-
if run.Event == webhook_module.HookEventPullRequest {
132+
if run.Event == webhook_module.HookEventPullRequest || run.Event == webhook_module.HookEventPullRequestSync {
133133
var payload api.PullRequestPayload
134134
if err := json.Unmarshal([]byte(run.EventPayload), &payload); err != nil {
135135
return nil, err

services/actions/commit_status.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func CreateCommitStatus(ctx context.Context, job *actions_model.ActionRunJob) er
4545

4646
sha = payload.HeadCommit.ID
4747
creatorID = payload.Pusher.ID
48-
case webhook_module.HookEventPullRequest:
48+
case webhook_module.HookEventPullRequest, webhook_module.HookEventPullRequestSync:
4949
payload, err := run.GetPullRequestEventPayload()
5050
if err != nil {
5151
return fmt.Errorf("GetPullRequestEventPayload: %w", err)

0 commit comments

Comments
 (0)