Skip to content

Commit

Permalink
fix: merge github context into env when read and setup
Browse files Browse the repository at this point in the history
  • Loading branch information
KnisterPeter authored and github-actions committed Apr 15, 2022
1 parent 4cf64b5 commit 228537c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/runner/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 228537c

Please sign in to comment.