diff --git a/pkg/container/docker_run.go b/pkg/container/docker_run.go index 3dddd02..827b66f 100644 --- a/pkg/container/docker_run.go +++ b/pkg/container/docker_run.go @@ -399,7 +399,7 @@ func (cr *containerReference) extractPath(env *map[string]string) common.Executo s := bufio.NewScanner(reader) for s.Scan() { line := s.Text() - localEnv["PATH"] = fmt.Sprintf("%s:%s", localEnv["PATH"], line) + localEnv["PATH"] = fmt.Sprintf("%s:%s", line, localEnv["PATH"]) } env = &localEnv diff --git a/pkg/runner/testdata/env-and-path/push.yaml b/pkg/runner/testdata/env-and-path/push.yaml index 7972924..e1928cb 100644 --- a/pkg/runner/testdata/env-and-path/push.yaml +++ b/pkg/runner/testdata/env-and-path/push.yaml @@ -13,10 +13,30 @@ jobs: echo "$HOME/someOtherFolder" >> $GITHUB_PATH - name: "Check PATH" run: | - if [[ ! "${PATH}" =~ .*"$HOME/"someFolder.*"$HOME/"someOtherFolder ]]; then - echo "${PATH} doesn't match .*someFolder.*someOtherFolder" + echo "${PATH}" + if [[ ! "${PATH}" =~ .*"$HOME/"someOtherFolder.*"$HOME/"someFolder.* ]]; then + echo "${PATH} doesn't match .*someOtherFolder.*someFolder.*" exit 1 fi + - name: "Prepend" + run: | + if ls | grep -q 'called ls' ; then + echo 'ls was overridden already?' + exit 2 + fi + path_add=$(mktemp -d) + cat > $path_add/ls <> $GITHUB_PATH + - name: "Verify prepend" + run: | + if ! ls | grep -q 'called ls' ; then + echo 'ls was not overridden' + exit 2 + fi - name: "Write single line env to $GITHUB_ENV" run: | echo "KEY=value" >> $GITHUB_ENV