From 228537ce1662eacc65205dc2996fa933a01d0384 Mon Sep 17 00:00:00 2001 From: Markus Wolf Date: Wed, 30 Mar 2022 11:51:34 +0200 Subject: [PATCH] fix: merge github context into env when read and setup --- pkg/runner/action.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/runner/action.go b/pkg/runner/action.go index 7001adf7dec..c9272d26dbf 100644 --- a/pkg/runner/action.go +++ b/pkg/runner/action.go @@ -109,6 +109,24 @@ func runActionImpl(step actionStep, actionDir string, remoteAction *remoteAction action := step.getActionModel() log.Debugf("About to run action %v", action) + if remoteAction != nil { + rc.ActionRepository = fmt.Sprintf("%s/%s", remoteAction.Org, remoteAction.Repo) + rc.ActionRef = remoteAction.Ref + } else { + rc.ActionRepository = "" + rc.ActionRef = "" + } + defer (func() { + // cleanup after the action is done, to avoid side-effects in + // the next step/action + rc.ActionRepository = "" + rc.ActionRef = "" + })() + + // we need to merge with github-env again, since at the step setup + // time, we don't have all environment prepared + mergeIntoMap(step.getEnv(), rc.withGithubEnv(map[string]string{})) + populateEnvsFromInput(step.getEnv(), action, rc) actionLocation := path.Join(actionDir, actionPath)