Make runs-on support variable expression (#29468)

As title.
Close issue: https://gitea.com/gitea/act_runner/issues/445
Follow: https://gitea.com/gitea/act/pulls/91

Move `getSecretsOfTask` and `getVariablesOfTask` under `models` because
of circular dependency issues.

(cherry picked from commit a1f5dd767729e30d07ab42fda80c19f30a72679f)
This commit is contained in:
sillyguodong 2024-03-08 14:14:35 +08:00 committed by Earl Warren
parent 1090734255
commit 6cb9e8d869
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
6 changed files with 99 additions and 72 deletions

View file

@ -305,7 +305,18 @@ func handleWorkflows(
run.NeedApproval = need
}
jobs, err := jobparser.Parse(dwf.Content)
if err := run.LoadAttributes(ctx); err != nil {
log.Error("LoadAttributes: %v", err)
continue
}
vars, err := actions_model.GetVariablesOfRun(ctx, run)
if err != nil {
log.Error("GetVariablesOfRun: %v", err)
continue
}
jobs, err := jobparser.Parse(dwf.Content, jobparser.WithVars(vars))
if err != nil {
log.Error("jobparser.Parse: %v", err)
continue