actions / actions/toolkit

Add support for getting a temporary directory

Open
#518 5 comments 58 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading packages/cache/src/internal/cacheUtils.ts and packages/tool-cache/src/tool-cache.ts, which already reference temporary-directory handling, then inspect the RUNNER_TEMP environment entry point. Determine whether @actions/io or @actions/core is the appropriate home; done means callers can obtain the runner temporary directory and documentation covers cleanup after jobs and runner crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
devops, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.