refactor: fix add-path / GITHUB_PATH commands (#1472)

* fix: add-path / GITHUB_PATH commands

* Disable old code

* fix: missing mock

* Update tests

* fix tests

* UpdateExtraPath skip on dryrun

* patch test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
ChristopherHX
2022-12-09 12:16:15 +01:00
committed by GitHub
parent 7d9951200f
commit d281230cce
12 changed files with 95 additions and 46 deletions

View File

@@ -134,7 +134,6 @@ func TestSetupEnv(t *testing.T) {
Env: map[string]string{
"RC_KEY": "rcvalue",
},
ExtraPath: []string{"/path/to/extra/file"},
JobContainer: cm,
}
step := &model.Step{
@@ -142,9 +141,7 @@ func TestSetupEnv(t *testing.T) {
"STEP_WITH": "with-value",
},
}
env := map[string]string{
"PATH": "",
}
env := map[string]string{}
sm.On("getRunContext").Return(rc)
sm.On("getGithubContext").Return(rc)
@@ -153,7 +150,6 @@ func TestSetupEnv(t *testing.T) {
cm.On("UpdateFromImageEnv", &env).Return(func(ctx context.Context) error { return nil })
cm.On("UpdateFromEnv", "/var/run/act/workflow/envs.txt", &env).Return(func(ctx context.Context) error { return nil })
cm.On("UpdateFromPath", &env).Return(func(ctx context.Context) error { return nil })
err := setupEnv(context.Background(), sm)
assert.Nil(t, err)
@@ -184,7 +180,6 @@ func TestSetupEnv(t *testing.T) {
"GITHUB_GRAPHQL_URL": "https:///api/graphql",
"GITHUB_HEAD_REF": "",
"GITHUB_JOB": "",
"GITHUB_PATH": "/var/run/act/workflow/paths.txt",
"GITHUB_RETENTION_DAYS": "0",
"GITHUB_RUN_ID": "runId",
"GITHUB_RUN_NUMBER": "1",
@@ -192,7 +187,6 @@ func TestSetupEnv(t *testing.T) {
"GITHUB_TOKEN": "",
"GITHUB_WORKFLOW": "",
"INPUT_STEP_WITH": "with-value",
"PATH": "/path/to/extra/file:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"RC_KEY": "rcvalue",
"RUNNER_PERFLOG": "/dev/null",
"RUNNER_TRACKING_ID": "",