mirror of
1
Fork 0

Add vars context to cron jobs (#3059)

Introduce vars context into cron triggered actions

Fixes #3044

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3059
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
This commit is contained in:
TheFox0x7 2024-04-06 19:54:53 +00:00 committed by Earl Warren
parent d9f6c59543
commit 5f05196915
1 changed files with 10 additions and 1 deletions

View File

@ -127,8 +127,17 @@ func CreateScheduleTask(ctx context.Context, cron *actions_model.ActionSchedule)
Status: actions_model.StatusWaiting, Status: actions_model.StatusWaiting,
} }
if err := run.LoadAttributes(ctx); err != nil {
log.Error("LoadAttributes: %v", err)
}
vars, err := actions_model.GetVariablesOfRun(ctx, run)
if err != nil {
log.Error("GetVariablesOfSchedule: %v", err)
}
// Parse the workflow specification from the cron schedule // 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 { if err != nil {
return err return err
} }