Is it possible to persist a WORKDIR between Actions in GitHub Actions?

Answering this myself in case someone else runs into this issue (and, like me, didn't fully read the docs!). :o)

The docs here explain, but essentially the working directory of any container you start as part of an action exists as /github/workspace. Actions can modify the contents of this working directory, and when containers are started in subsequent actions during the workflow, the working directory for these actions/containers will contain the modifications made earlier in the workflow.

So, the answer is yes, the Docker WORKDIR at /github/workspace is persisted throughout a GitHub Actions workflow in a similar way to how it can persist in a CircleCI workflow.


On my tests today, it cannot persist files between jobs. CircleCi does, there you can store some content to read on next jobs, but on GitHub Actions I can't.

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