BUILD-11553 Use RUNNER_TEMP for get-build-number cache file#287
BUILD-11553 Use RUNNER_TEMP for get-build-number cache file#287matemoln wants to merge 2 commits into
Conversation
Write build_number.txt under RUNNER_TEMP instead of the workspace checkout so ephemeral cache state does not pollute the repository tree.
There was a problem hiding this comment.
Pull request overview
This PR updates the get-build-number composite action and its ShellSpec tests to store the cached build_number.txt under RUNNER_TEMP (instead of the workspace checkout), preventing ephemeral cache state from modifying the repository tree during workflow runs.
Changes:
- Update the action to write/read the build number file via a
BUILD_NUMBER_FILEpath pointing to${RUNNER_TEMP}/build_number.txt. - Update the underlying
get_build_number.shscript to useBUILD_NUMBER_FILE/RUNNER_TEMPfor its cache file location. - Adjust ShellSpec tests to set
RUNNER_TEMPand assert the cache file is created in the temp directory.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| spec/get_build_number_spec.sh | Sets RUNNER_TEMP in tests and updates assertions to expect the cache file in temp. |
| get-build-number/get_build_number.sh | Uses BUILD_NUMBER_FILE / RUNNER_TEMP to determine where to write the cache file. |
| get-build-number/action.yml | Exports BUILD_NUMBER_FILE into the composite action environment and updates cache/read/write steps to use it. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| : "${GITHUB_REPOSITORY:?}" | ||
| GH_API_VERSION_HEADER="X-GitHub-Api-Version: 2022-11-28" | ||
| CACHE_FILE="build_number.txt" | ||
| CACHE_FILE="${BUILD_NUMBER_FILE:-${RUNNER_TEMP}/build_number.txt}" |
Override BUILD_NUMBER_FILE in the spec so tests do not inherit the path set by config-npm during the test-shell-scripts workflow.
Code Review ✅ ApprovedUpdates the build number cache location to use RUNNER_TEMP instead of the workspace directory. This change prevents ephemeral build artifacts from polluting the repository tree. OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|



Write build_number.txt under RUNNER_TEMP instead of the workspace checkout so ephemeral cache state does not pollute the repository tree.