maxheld
maxheld

Reputation: 4273

does /github/home persist between github actions?

So far, I was under the impression as per the file system docs that (only?) /github/workspace persists across actions (not workflows):

The working directory of the Docker container. GitHub Actions execute in this directory. The path to this directory is set in the GITHUB_WORKSPACE environment variable.

(...)

An action can modify the contents of this directory, which subsequent actions can access.

But I now have a reprex (live repo with action runs) showing that /github/home also appears to persist across actions.

Of course I understand that none of these persist across workflows, or runs. Just between actions.

The documentation (to me) is a bit unclear about this, and I haven't gotten an answer from support.

Log from first action on /github/home:

Running 'touch /github/home/foo'...
Successfully ran 'touch /github/home/foo'

Log from second action on /github/home:

Running 'ls /github/home'...
foo
Successfully ran 'ls /github/home'
Running 'rm /github/home/foo'...
Successfully ran 'rm /github/home/foo'

That seems to suggest that indeed, /github/home also persists, but I'd like to know for sure.

Upvotes: 6

Views: 2266

Answers (2)

Tiago Gouvêa
Tiago Gouvêa

Reputation: 16740

My quick answer to your question is: /github/home doesn't persis between jobs/actions.

Following, my tests:

Write file on a job, try to read on the next

Used test file.

1) Writing on GITHUB_WORKSPACE
My path: /home/runner/work/github-actions-test/github-actions-test)
Results: writeable and readble on first job, but, empty on second job Action link

2) Writing on /github/home
My path: /github/home
Results: cannot access '/github/home/ Action link

3) Writing on /home
My path: /home
Results: touch: cannot touch '/home/myFile.txt': Permission denied
Action link

Conclusion

My conclusion for now (August 23th 2019) is that cannot persist files between jobs on any folder.

Upvotes: 4

maxheld
maxheld

Reputation: 4273

GitHub Actions support confirmed that all of /github persists throughout a workflow run.

Upvotes: 0

Related Questions