Skip to content

Commit

Permalink
fix: move envs.txt & event.json to /tmp/
Browse files Browse the repository at this point in the history
Since nektos#635 `envs.txt` is not copying properly when running `act` in WSL2
Moving it to fixed location resolves that.
  • Loading branch information
hackercat committed May 5, 2021
1 parent 0f1df59 commit 854d556
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/runner/run_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,14 @@ func (rc *RunContext) startJobContainer() common.Executor {
rc.JobContainer.Start(false),
rc.JobContainer.UpdateFromEnv("/etc/environment", &rc.Env),
rc.JobContainer.CopyDir(copyToPath, rc.Config.Workdir+string(filepath.Separator)+".", rc.Config.UseGitIgnore).IfBool(copyWorkspace),
rc.JobContainer.Copy(rc.Config.ContainerWorkdir(), &container.FileEntry{
rc.JobContainer.Copy("/tmp/", &container.FileEntry{
Name: "workflow/event.json",
Mode: 0644,
Body: rc.EventJSON,
}, &container.FileEntry{
Name: "workflow/envs.txt",
Mode: 0644,
Body: "",
}, &container.FileEntry{
Name: "home/.act",
Mode: 0644,
Body: "",
}),
)(ctx)
}
Expand Down Expand Up @@ -486,7 +482,7 @@ func (rc *RunContext) getGithubContext() *githubContext {
}
ghc := &githubContext{
Event: make(map[string]interface{}),
EventPath: fmt.Sprintf("%s/%s", rc.Config.ContainerWorkdir(), "workflow/event.json"),
EventPath: "/tmp/workflow/event.json",
Workflow: rc.Run.Workflow.Name,
RunID: runID,
RunNumber: runNumber,
Expand Down Expand Up @@ -628,7 +624,7 @@ func withDefaultBranch(b string, event map[string]interface{}) map[string]interf
func (rc *RunContext) withGithubEnv(env map[string]string) map[string]string {
github := rc.getGithubContext()
env["CI"] = "true"
env["GITHUB_ENV"] = fmt.Sprintf("%s/%s", rc.Config.ContainerWorkdir(), "workflow/envs.txt")
env["GITHUB_ENV"] = "/tmp/workflow/envs.txt"
env["GITHUB_WORKFLOW"] = github.Workflow
env["GITHUB_RUN_ID"] = github.RunID
env["GITHUB_RUN_NUMBER"] = github.RunNumber
Expand Down

0 comments on commit 854d556

Please sign in to comment.