@@ -31,7 +31,7 @@ func CreateCommitStatusForRunJobs(ctx context.Context, run *actions_model.Action
3131 return
3232 }
3333
34- event , commitID , err := getCommitStatusEventNameAndSHA (run )
34+ event , commitID , err := getCommitStatusEventNameAndCommitID (run )
3535 if err != nil {
3636 log .Error ("GetCommitStatusEventNameAndSHA: %v" , err )
3737 } else if event == "" || commitID == "" {
@@ -50,7 +50,7 @@ func CreateCommitStatusForRunJobs(ctx context.Context, run *actions_model.Action
5050 }
5151}
5252
53- func getCommitStatusEventNameAndSHA (run * actions_model.ActionRun ) (event , sha string , _ error ) {
53+ func getCommitStatusEventNameAndCommitID (run * actions_model.ActionRun ) (event , commitID string , _ error ) {
5454 switch run .Event {
5555 case webhook_module .HookEventPush :
5656 event = "push"
@@ -61,7 +61,7 @@ func getCommitStatusEventNameAndSHA(run *actions_model.ActionRun) (event, sha st
6161 if payload .HeadCommit == nil {
6262 return "" , "" , errors .New ("head commit is missing in event payload" )
6363 }
64- sha = payload .HeadCommit .ID
64+ commitID = payload .HeadCommit .ID
6565 case // pull_request
6666 webhook_module .HookEventPullRequest ,
6767 webhook_module .HookEventPullRequestSync ,
@@ -83,14 +83,13 @@ func getCommitStatusEventNameAndSHA(run *actions_model.ActionRun) (event, sha st
8383 } else if payload .PullRequest .Head == nil {
8484 return "" , "" , errors .New ("head of pull request is missing in event payload" )
8585 }
86- sha = payload .PullRequest .Head .Sha
86+ commitID = payload .PullRequest .Head .Sha
8787 case webhook_module .HookEventRelease :
8888 event = string (run .Event )
89- sha = run .CommitSHA
90- default :
91- return "" , "" , nil
89+ commitID = run .CommitSHA
90+ default : // do nothing, return empty
9291 }
93- return event , sha , nil
92+ return event , commitID , nil
9493}
9594
9695func createCommitStatus (ctx context.Context , repo * repo_model.Repository , event , commitID string , run * actions_model.ActionRun , job * actions_model.ActionRunJob ) error {
0 commit comments