mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	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: 
This commit is contained in:
		@@ -129,7 +129,7 @@ func (run *ActionRun) GetPushEventPayload() (*api.PushPayload, error) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (run *ActionRun) GetPullRequestEventPayload() (*api.PullRequestPayload, error) {
 | 
					func (run *ActionRun) GetPullRequestEventPayload() (*api.PullRequestPayload, error) {
 | 
				
			||||||
	if run.Event == webhook_module.HookEventPullRequest {
 | 
						if run.Event == webhook_module.HookEventPullRequest || run.Event == webhook_module.HookEventPullRequestSync {
 | 
				
			||||||
		var payload api.PullRequestPayload
 | 
							var payload api.PullRequestPayload
 | 
				
			||||||
		if err := json.Unmarshal([]byte(run.EventPayload), &payload); err != nil {
 | 
							if err := json.Unmarshal([]byte(run.EventPayload), &payload); err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,7 @@ func CreateCommitStatus(ctx context.Context, job *actions_model.ActionRunJob) er
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		sha = payload.HeadCommit.ID
 | 
							sha = payload.HeadCommit.ID
 | 
				
			||||||
		creatorID = payload.Pusher.ID
 | 
							creatorID = payload.Pusher.ID
 | 
				
			||||||
	case webhook_module.HookEventPullRequest:
 | 
						case webhook_module.HookEventPullRequest, webhook_module.HookEventPullRequestSync:
 | 
				
			||||||
		payload, err := run.GetPullRequestEventPayload()
 | 
							payload, err := run.GetPullRequestEventPayload()
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return fmt.Errorf("GetPullRequestEventPayload: %w", err)
 | 
								return fmt.Errorf("GetPullRequestEventPayload: %w", err)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user