@@ -22,7 +22,7 @@ import (
2222
2323type DetectedWorkflow struct {
2424 EntryName string
25- TriggerEvent * jobparser. Event
25+ TriggerEvent string
2626 Content []byte
2727}
2828
@@ -103,7 +103,6 @@ func DetectWorkflows(
103103 commit * git.Commit ,
104104 triggedEvent webhook_module.HookEventType ,
105105 payload api.Payloader ,
106- detectSchedule bool ,
107106) ([]* DetectedWorkflow , []* DetectedWorkflow , error ) {
108107 entries , err := ListWorkflows (commit )
109108 if err != nil {
@@ -118,7 +117,6 @@ func DetectWorkflows(
118117 return nil , nil , err
119118 }
120119
121- // one workflow may have multiple events
122120 events , err := GetEventsFromContent (content )
123121 if err != nil {
124122 log .Warn ("ignore invalid workflow %q: %v" , entry .Name (), err )
@@ -127,18 +125,17 @@ func DetectWorkflows(
127125 for _ , evt := range events {
128126 log .Trace ("detect workflow %q for event %#v matching %q" , entry .Name (), evt , triggedEvent )
129127 if evt .IsSchedule () {
130- if detectSchedule {
131- dwf := & DetectedWorkflow {
132- EntryName : entry .Name (),
133- TriggerEvent : evt ,
134- Content : content ,
135- }
136- schedules = append (schedules , dwf )
128+ dwf := & DetectedWorkflow {
129+ EntryName : entry .Name (),
130+ TriggerEvent : evt .Name ,
131+ Content : content ,
137132 }
138- } else if detectMatched (gitRepo , commit , triggedEvent , payload , evt ) {
133+ schedules = append (schedules , dwf )
134+ }
135+ if detectMatched (gitRepo , commit , triggedEvent , payload , evt ) {
139136 dwf := & DetectedWorkflow {
140137 EntryName : entry .Name (),
141- TriggerEvent : evt ,
138+ TriggerEvent : evt . Name ,
142139 Content : content ,
143140 }
144141 workflows = append (workflows , dwf )
@@ -159,8 +156,7 @@ func detectMatched(gitRepo *git.Repository, commit *git.Commit, triggedEvent web
159156 webhook_module .HookEventCreate ,
160157 webhook_module .HookEventDelete ,
161158 webhook_module .HookEventFork ,
162- webhook_module .HookEventWiki ,
163- webhook_module .HookEventSchedule :
159+ webhook_module .HookEventWiki :
164160 if len (evt .Acts ()) != 0 {
165161 log .Warn ("Ignore unsupported %s event arguments %v" , triggedEvent , evt .Acts ())
166162 }
0 commit comments