Switch to interface{} instead of map[string]... (#700)

* fix: change `env` to be an interface

allows to use GitHub functions like `fromJson()`

* fix: change matrix to an interface instead of map

This allows to use GitHub functions like `fromJson()` to create dynamic
matrixes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Ryan (hackercat)
2021-06-06 14:53:18 +00:00
committed by GitHub
parent fa93f4d5e7
commit 33ccfa6f3b
3 changed files with 76 additions and 20 deletions

View File

@@ -55,7 +55,7 @@ type stepResult struct {
// GetEnv returns the env for the context
func (rc *RunContext) GetEnv() map[string]string {
if rc.Env == nil {
rc.Env = mergeMaps(rc.Config.Env, rc.Run.Workflow.Env, rc.Run.Job().Env)
rc.Env = mergeMaps(rc.Config.Env, rc.Run.Workflow.Env, rc.Run.Job().Environment())
}
rc.Env["ACT"] = "true"
return rc.Env

View File

@@ -574,13 +574,15 @@ func (sc *StepContext) execAsComposite(ctx context.Context, step *model.Step, _
stepClone.Env = make(map[string]string)
}
actionPath := filepath.Join(containerActionDir, actionName)
stepClone.Env["GITHUB_ACTION_PATH"] = actionPath
env := stepClone.Environment()
env["GITHUB_ACTION_PATH"] = actionPath
stepClone.Run = strings.ReplaceAll(stepClone.Run, "${{ github.action_path }}", actionPath)
stepContext := StepContext{
RunContext: rcClone,
Step: &stepClone,
Env: mergeMaps(sc.Env, stepClone.Env),
Env: mergeMaps(sc.Env, env),
}
// Interpolate the outer inputs into the composite step with items