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