aboutsummaryrefslogtreecommitdiffstats
path: root/services/actions
diff options
context:
space:
mode:
authorsillyguodong <33891828+sillyguodong@users.noreply.github.com>2024-04-24 02:55:25 +0800
committerGitHub <noreply@github.com>2024-04-23 20:55:25 +0200
commit2f6b1c46a1a4a90f56ca0f3ad7840e8e70daeab5 (patch)
treea0285609b16d287a8431586be22ec54acac309ec /services/actions
parentb79e3db264e5734d8cc038be898d45186b3afcbd (diff)
downloadgitea-2f6b1c46a1a4a90f56ca0f3ad7840e8e70daeab5.tar.gz
gitea-2f6b1c46a1a4a90f56ca0f3ad7840e8e70daeab5.zip
Interpolate runs-on with variables when scheduling tasks (#30640)
Follow #29468 1. Interpolate runs-on with variables when scheduling tasks. 2. The `GetVariablesOfRun` function will check if the `Repo` of the run is nil. --------- Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'services/actions')
-rw-r--r--services/actions/schedule_tasks.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/services/actions/schedule_tasks.go b/services/actions/schedule_tasks.go
index e4e56e5122..18f3324fd2 100644
--- a/services/actions/schedule_tasks.go
+++ b/services/actions/schedule_tasks.go
@@ -132,8 +132,14 @@ func CreateScheduleTask(ctx context.Context, cron *actions_model.ActionSchedule)
Status: actions_model.StatusWaiting,
}
+ vars, err := actions_model.GetVariablesOfRun(ctx, run)
+ if err != nil {
+ log.Error("GetVariablesOfRun: %v", err)
+ return err
+ }
+
// Parse the workflow specification from the cron schedule
- workflows, err := jobparser.Parse(cron.Content)
+ workflows, err := jobparser.Parse(cron.Content, jobparser.WithVars(vars))
if err != nil {
return err
}