aboutsummaryrefslogtreecommitdiffstats
path: root/services/actions
diff options
context:
space:
mode:
authorZettat123 <zettat123@gmail.com>2024-04-01 21:48:14 +0800
committerGitHub <noreply@github.com>2024-04-01 13:48:14 +0000
commit1ef2eb50d82d07b1e4ff312ef58953d1bba2437a (patch)
tree9ee533ee82438d49e8147b2fecaa7ffe5b66c9ac /services/actions
parent751997ad34fdd52b9f3956b14395560b059c9ac1 (diff)
downloadgitea-1ef2eb50d82d07b1e4ff312ef58953d1bba2437a.tar.gz
gitea-1ef2eb50d82d07b1e4ff312ef58953d1bba2437a.zip
Remove scheduled action tasks if the repo is archived (#30224)
Fix #30220
Diffstat (limited to 'services/actions')
-rw-r--r--services/actions/notifier_helper.go4
-rw-r--r--services/actions/schedule_tasks.go5
2 files changed, 7 insertions, 2 deletions
diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go
index 66a19844c2..8c98f56af5 100644
--- a/services/actions/notifier_helper.go
+++ b/services/actions/notifier_helper.go
@@ -117,7 +117,7 @@ func notify(ctx context.Context, input *notifyInput) error {
log.Debug("ignore executing %v for event %v whose doer is %v", getMethod(ctx), input.Event, input.Doer.Name)
return nil
}
- if input.Repo.IsEmpty {
+ if input.Repo.IsEmpty || input.Repo.IsArchived {
return nil
}
if unit_model.TypeActions.UnitGlobalDisabled() {
@@ -501,7 +501,7 @@ func handleSchedules(
// DetectAndHandleSchedules detects the schedule workflows on the default branch and create schedule tasks
func DetectAndHandleSchedules(ctx context.Context, repo *repo_model.Repository) error {
- if repo.IsEmpty {
+ if repo.IsEmpty || repo.IsArchived {
return nil
}
diff --git a/services/actions/schedule_tasks.go b/services/actions/schedule_tasks.go
index 59862fd0d8..e4e56e5122 100644
--- a/services/actions/schedule_tasks.go
+++ b/services/actions/schedule_tasks.go
@@ -66,6 +66,11 @@ func startTasks(ctx context.Context) error {
}
}
+ if row.Repo.IsArchived {
+ // Skip if the repo is archived
+ continue
+ }
+
cfg, err := row.Repo.GetUnit(ctx, unit.TypeActions)
if err != nil {
if repo_model.IsErrUnitTypeNotExist(err) {