Skip to content

Commit d1dca38

Browse files
authored
Fix schedule actions still running even if workflow disalbed (#26939)
Fix #26782
1 parent 1ee4882 commit d1dca38

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

services/actions/schedule_tasks.go

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
actions_model "code.gitea.io/gitea/models/actions"
1212
"code.gitea.io/gitea/models/db"
13+
"code.gitea.io/gitea/models/unit"
1314
"code.gitea.io/gitea/modules/log"
1415
"code.gitea.io/gitea/modules/timeutil"
1516
webhook_module "code.gitea.io/gitea/modules/webhook"
@@ -44,6 +45,10 @@ func startTasks(ctx context.Context) error {
4445
return fmt.Errorf("find specs: %w", err)
4546
}
4647

48+
if err := specs.LoadRepos(); err != nil {
49+
return fmt.Errorf("LoadRepos: %w", err)
50+
}
51+
4752
// Loop through each spec and create a schedule task for it
4853
for _, row := range specs {
4954
// cancel running jobs if the event is push
@@ -59,6 +64,11 @@ func startTasks(ctx context.Context) error {
5964
}
6065
}
6166

67+
cfg := row.Repo.MustGetUnit(ctx, unit.TypeActions).ActionsConfig()
68+
if cfg.IsWorkflowDisabled(row.Schedule.WorkflowID) {
69+
continue
70+
}
71+
6272
if err := CreateScheduleTask(ctx, row.Schedule); err != nil {
6373
log.Error("CreateScheduleTask: %v", err)
6474
return err

0 commit comments

Comments
 (0)