diff options
author | sillyguodong <33891828+sillyguodong@users.noreply.github.com> | 2024-04-24 02:55:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 20:55:25 +0200 |
commit | 2f6b1c46a1a4a90f56ca0f3ad7840e8e70daeab5 (patch) | |
tree | a0285609b16d287a8431586be22ec54acac309ec /services/actions | |
parent | b79e3db264e5734d8cc038be898d45186b3afcbd (diff) | |
download | gitea-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.go | 8 |
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 } |