Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for getting a temporary directory #518

Open
konradpabjan opened this issue Jul 15, 2020 · 4 comments
Open

Add support for getting a temporary directory #518

konradpabjan opened this issue Jul 15, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@konradpabjan
Copy link
Contributor

The runner has a temporary directory that gets cleaned up after each job. You can access it by doing process.env['RUNNER_TEMP'], this can be used for a lot of things such as creating temporary files for tests or during a job and users don't need to worry about this being cleaned up.

A lot of first party actions and third party actions could use this. A lot of first party actions are in-fact using the temp directory currently:

  • cache
  • tool-cache
  • setup-java and setup-python will soon be using the temp directory too for a variety of things

A method should be added to either @actions/io or @actions/core that will allow users to quickly get a temporary directory.

There should also be documentation added that mentions when this gets cleaned up, and under what circumstances it won't (runner crashes)

@bbqsrc
Copy link

bbqsrc commented Sep 23, 2020

This is reasonably important for sensitive things such as temporary secrets on self-hosted runners on macOS or Windows where containers are not possible.

@koppor
Copy link

koppor commented Aug 18, 2021

For the googlers coming here: In the case of a Docker-based action, one CANNOT access that. See https://github.community/t/how-can-i-access-the-current-repo-context-and-files-from-a-docker-container-action/17711/8 for details.

@minherz
Copy link

minherz commented Nov 15, 2022

What about using the runner's temporary directory runner.temp?

@nelsonic
Copy link

runner.temp doesn't appear to be writeable.
is there a usage example that demonstrates creating & deleting files in the runner.temp directory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants