Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/runner/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ func setupActionEnv(ctx context.Context, step actionStep, _ *remoteAction) error
populateEnvsFromSavedState(step.getEnv(), step, rc)
populateEnvsFromInput(ctx, step.getEnv(), step.getActionModel(), rc)

mirrorGithubEnvToAllSpice(*step.getEnv())

return nil
}

Expand Down
14 changes: 14 additions & 0 deletions pkg/runner/run_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,20 @@ func (rc *RunContext) withGithubEnv(ctx context.Context, github *model.GithubCon
return env
}

func mirrorGithubEnvToAllSpice(env map[string]string) {
keysToMirror := []string{}

for key := range env {
if strings.HasPrefix(key, "GITHUB_") {
keysToMirror = append(keysToMirror, strings.TrimPrefix(key, "GITHUB_"))
}
}

for _, trimmedKey := range keysToMirror {
env["ALLSPICE_"+trimmedKey] = env["GITHUB_"+trimmedKey]
}
}

func setActionRuntimeVars(rc *RunContext, env map[string]string) {
actionsRuntimeURL := os.Getenv("ACTIONS_RUNTIME_URL")
if actionsRuntimeURL == "" {
Expand Down
9 changes: 1 addition & 8 deletions pkg/runner/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,7 @@ func runStepExecutor(step step, stage stepStage, executor common.Executor) commo
(*step.getEnv())["GITEA_STEP_SUMMARY"] = (*step.getEnv())["GITHUB_STEP_SUMMARY"]
}

{
// For AllSpice
(*step.getEnv())["ALLSPICE_OUTPUT"] = (*step.getEnv())["GITHUB_OUTPUT"]
(*step.getEnv())["ALLSPICE_STATE"] = (*step.getEnv())["GITHUB_STATE"]
(*step.getEnv())["ALLSPICE_PATH"] = (*step.getEnv())["GITHUB_PATH"]
(*step.getEnv())["ALLSPICE_ENV"] = (*step.getEnv())["GITHUB_ENV"]
(*step.getEnv())["ALLSPICE_STEP_SUMMARY"] = (*step.getEnv())["GITHUB_STEP_SUMMARY"]
}
mirrorGithubEnvToAllSpice(*step.getEnv())

_ = rc.JobContainer.Copy(actPath, &container.FileEntry{
Name: outputFileCommand,
Expand Down
Loading