@@ -115,11 +115,20 @@ func (input *notifyInput) Notify(ctx context.Context) {
115115}
116116
117117func  notify (ctx  context.Context , input  * notifyInput ) error  {
118+ 	shouldDetectSchedules  :=  input .Event  ==  webhook_module .HookEventPush  &&  input .Ref .BranchName () ==  input .Repo .DefaultBranch 
118119	if  input .Doer .IsActions () {
119120		// avoiding triggering cyclically, for example: 
120121		// a comment of an issue will trigger the runner to add a new comment as reply, 
121122		// and the new comment will trigger the runner again. 
122123		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+ 
123132		return  nil 
124133	}
125134	if  input .Repo .IsEmpty  ||  input .Repo .IsArchived  {
@@ -173,7 +182,6 @@ func notify(ctx context.Context, input *notifyInput) error {
173182
174183	var  detectedWorkflows  []* actions_module.DetectedWorkflow 
175184	actionsConfig  :=  input .Repo .MustGetUnit (ctx , unit_model .TypeActions ).ActionsConfig ()
176- 	shouldDetectSchedules  :=  input .Event  ==  webhook_module .HookEventPush  &&  input .Ref .BranchName () ==  input .Repo .DefaultBranch 
177185	workflows , schedules , err  :=  actions_module .DetectWorkflows (gitRepo , commit ,
178186		input .Event ,
179187		input .Payload ,
0 commit comments