1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-25 13:19:37 -05:00

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

View file

@ -127,8 +127,17 @@ func CreateScheduleTask(ctx context.Context, cron *actions_model.ActionSchedule)
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
workflows, err := jobparser.Parse(cron.Content)
workflows, err := jobparser.Parse(cron.Content, jobparser.WithVars(vars))
if err != nil {
return err
}