mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-06 23:44:20 -04:00
Fix schedule actions still running even if workflow disalbed (#26939)
Fix #26782
This commit is contained in:
parent
1ee4882b88
commit
d1dca38a2a
@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
actions_model "code.gitea.io/gitea/models/actions"
|
actions_model "code.gitea.io/gitea/models/actions"
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
|
"code.gitea.io/gitea/models/unit"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
webhook_module "code.gitea.io/gitea/modules/webhook"
|
webhook_module "code.gitea.io/gitea/modules/webhook"
|
||||||
@ -44,6 +45,10 @@ func startTasks(ctx context.Context) error {
|
|||||||
return fmt.Errorf("find specs: %w", err)
|
return fmt.Errorf("find specs: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := specs.LoadRepos(); err != nil {
|
||||||
|
return fmt.Errorf("LoadRepos: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Loop through each spec and create a schedule task for it
|
// Loop through each spec and create a schedule task for it
|
||||||
for _, row := range specs {
|
for _, row := range specs {
|
||||||
// cancel running jobs if the event is push
|
// cancel running jobs if the event is push
|
||||||
@ -59,6 +64,11 @@ func startTasks(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg := row.Repo.MustGetUnit(ctx, unit.TypeActions).ActionsConfig()
|
||||||
|
if cfg.IsWorkflowDisabled(row.Schedule.WorkflowID) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if err := CreateScheduleTask(ctx, row.Schedule); err != nil {
|
if err := CreateScheduleTask(ctx, row.Schedule); err != nil {
|
||||||
log.Error("CreateScheduleTask: %v", err)
|
log.Error("CreateScheduleTask: %v", err)
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user