From 646206bd8a97462acf74de4f9131ed9472b0495f Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Tue, 21 Mar 2023 15:31:30 +0800 Subject: [PATCH] Add extra path env for running go actions (#26) At present, the runner can't run go actions even if the go environment has been set by the `setup-go` action. The reason is that `setup-go` will add the go related paths to [`GITHUB_PATH`](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path) but in #22 I forgot to apply them before running go actions. After adding the `ApplyExtraPath` function, the `setup-go` action runs properly. Reviewed-on: https://gitea.com/gitea/act/pulls/26 Reviewed-by: Jason Song Reviewed-by: Lunny Xiao Co-authored-by: Zettat123 Co-committed-by: Zettat123 --- act/runner/action.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/act/runner/action.go b/act/runner/action.go index c3bcb3f3..f85fb03b 100644 --- a/act/runner/action.go +++ b/act/runner/action.go @@ -176,6 +176,8 @@ func runActionImpl(step actionStep, actionDir string, remoteAction *remoteAction return err } + rc.ApplyExtraPath(ctx, step.getEnv()) + execFileName := fmt.Sprintf("%s.out", action.Runs.Main) buildArgs := []string{"go", "build", "-o", execFileName, action.Runs.Main} execArgs := []string{filepath.Join(containerActionDir, execFileName)} @@ -554,6 +556,8 @@ func runPreStep(step actionStep) common.Executor { return err } + rc.ApplyExtraPath(ctx, step.getEnv()) + execFileName := fmt.Sprintf("%s.out", action.Runs.Pre) buildArgs := []string{"go", "build", "-o", execFileName, action.Runs.Pre} execArgs := []string{filepath.Join(containerActionDir, execFileName)} @@ -657,6 +661,7 @@ func runPostStep(step actionStep) common.Executor { case model.ActionRunsUsingGo: populateEnvsFromSavedState(step.getEnv(), step, rc) + rc.ApplyExtraPath(ctx, step.getEnv()) execFileName := fmt.Sprintf("%s.out", action.Runs.Post) buildArgs := []string{"go", "build", "-o", execFileName, action.Runs.Post}