aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository
diff options
context:
space:
mode:
authorZettat123 <zettat123@gmail.com>2024-01-31 22:55:12 +0800
committerGitHub <noreply@github.com>2024-01-31 14:55:12 +0000
commitadc3598a755b43e3911266d7fa575c121e16613d (patch)
treeba5982153851b0b1267daae8d1a152d85448cd22 /services/repository
parent0b1a42ce0f7f8e22d7905bde803d60444c9a9f0b (diff)
downloadgitea-adc3598a755b43e3911266d7fa575c121e16613d.tar.gz
gitea-adc3598a755b43e3911266d7fa575c121e16613d.zip
Fix an actions schedule bug (#28942)
In #28691, schedule plans will be deleted when a repo's actions unit is disabled. But when the unit is enabled, the schedule plans won't be created again. This PR fixes the bug. The schedule plans will be created again when the actions unit is re-enabled
Diffstat (limited to 'services/repository')
-rw-r--r--services/repository/setting.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/services/repository/setting.go b/services/repository/setting.go
index 6496ac4014..b82f24271e 100644
--- a/services/repository/setting.go
+++ b/services/repository/setting.go
@@ -12,6 +12,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/log"
+ actions_service "code.gitea.io/gitea/services/actions"
)
// UpdateRepositoryUnits updates a repository's units
@@ -33,6 +34,15 @@ func UpdateRepositoryUnits(ctx context.Context, repo *repo_model.Repository, uni
}
}
+ for _, u := range units {
+ if u.Type == unit.TypeActions {
+ if err := actions_service.DetectAndHandleSchedules(ctx, repo); err != nil {
+ log.Error("DetectAndHandleSchedules: %v", err)
+ }
+ break
+ }
+ }
+
if _, err = db.GetEngine(ctx).Where("repo_id = ?", repo.ID).In("type", deleteUnitTypes).Delete(new(repo_model.RepoUnit)); err != nil {
return err
}