Skip to content

Commit ad24940

Browse files
committed
add
1 parent 3c1c508 commit ad24940

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

models/actions/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func (run *ActionRun) GetPushEventPayload() (*api.PushPayload, error) {
154154
}
155155

156156
func (run *ActionRun) GetPullRequestEventPayload() (*api.PullRequestPayload, error) {
157-
if run.Event == webhook_module.HookEventPullRequest || run.Event == webhook_module.HookEventPullRequestSync {
157+
if run.Event.IsPullRequest() {
158158
var payload api.PullRequestPayload
159159
if err := json.Unmarshal([]byte(run.EventPayload), &payload); err != nil {
160160
return nil, err

modules/webhook/type.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ func (h HookEventType) Event() string {
6969
return ""
7070
}
7171

72+
func (h HookEventType) IsPullRequest() bool {
73+
return h.Event() == "pull_request"
74+
}
75+
7276
// HookType is the type of a webhook
7377
type HookType = string
7478

services/actions/commit_status.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ func createCommitStatus(ctx context.Context, job *actions_model.ActionRunJob) er
5454
return fmt.Errorf("head commit is missing in event payload")
5555
}
5656
sha = payload.HeadCommit.ID
57-
case webhook_module.HookEventPullRequest, webhook_module.HookEventPullRequestSync:
57+
case // pull_request
58+
webhook_module.HookEventPullRequest,
59+
webhook_module.HookEventPullRequestSync,
60+
webhook_module.HookEventPullRequestAssign,
61+
webhook_module.HookEventPullRequestLabel,
62+
webhook_module.HookEventPullRequestReviewRequest,
63+
webhook_module.HookEventPullRequestMilestone:
5864
if run.TriggerEvent == actions_module.GithubEventPullRequestTarget {
5965
event = "pull_request_target"
6066
} else {

0 commit comments

Comments
 (0)