@@ -115,11 +115,20 @@ func (input *notifyInput) Notify(ctx context.Context) {
115
115
}
116
116
117
117
func notify (ctx context.Context , input * notifyInput ) error {
118
+ shouldDetectSchedules := input .Event == webhook_module .HookEventPush && input .Ref .BranchName () == input .Repo .DefaultBranch
118
119
if input .Doer .IsActions () {
119
120
// avoiding triggering cyclically, for example:
120
121
// a comment of an issue will trigger the runner to add a new comment as reply,
121
122
// and the new comment will trigger the runner again.
122
123
log .Debug ("ignore executing %v for event %v whose doer is %v" , getMethod (ctx ), input .Event , input .Doer .Name )
124
+
125
+ // we should update schedule tasks in this case, because
126
+ // 1. schedule tasks cannot be triggered by other events, so cyclic triggering will not occur
127
+ // 2. some schedule tasks may update the repo periodically, so the refs of schedule tasks need to be updated
128
+ if shouldDetectSchedules {
129
+ return DetectAndHandleSchedules (ctx , input .Repo )
130
+ }
131
+
123
132
return nil
124
133
}
125
134
if input .Repo .IsEmpty || input .Repo .IsArchived {
@@ -173,7 +182,6 @@ func notify(ctx context.Context, input *notifyInput) error {
173
182
174
183
var detectedWorkflows []* actions_module.DetectedWorkflow
175
184
actionsConfig := input .Repo .MustGetUnit (ctx , unit_model .TypeActions ).ActionsConfig ()
176
- shouldDetectSchedules := input .Event == webhook_module .HookEventPush && input .Ref .BranchName () == input .Repo .DefaultBranch
177
185
workflows , schedules , err := actions_module .DetectWorkflows (gitRepo , commit ,
178
186
input .Event ,
179
187
input .Payload ,
0 commit comments