| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Adds a restore-only input to the main actions/cache action to support “restore but don’t save” scenarios (e.g., avoid overwriting caches on non-default branches).
Changes:
Copilot reviewed 6 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file| File | Description |
|---|---|
| src/utils/testUtils.ts | Adds test input wiring/cleanup for restore-only. |
| src/saveImpl.ts | Adds restore-only handling in the post-save implementation. |
| src/constants.ts | Introduces Inputs.RestoreOnly. |
| tests/saveImpl.test.ts | Adds a test for restore-only behavior. |
| action.yml | Exposes restore-only as an action input. |
| README.md | Documents the new restore-only option and an example expression. |
| dist/save/index.js | Updates compiled save bundle for the new input/behavior. |
| dist/save-only/index.js | Updates compiled save-only bundle for the new input/behavior. |
| dist/restore/index.js | Updates compiled restore bundle enum to include the new input. |
| dist/restore-only/index.js | Updates compiled restore-only bundle enum to include the new input. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Introduces controlling when to save the cache with a flag.
Description
Introduces a new restore-only flag into the main @actions/cache. If set, the action will download the cache, but it will skip its saving at the post actions phase.
Fixes #1730
Motivation and Context
It's true that we do have the @actions/cache/restore and @actions/cache/save actions, but this change serves a new unsupported use-case: "only feed the cache given a condition".
This use case is a generalisation of the one I'm interesting on to support, which is "only feed the cache at the default branch". A topic you raise at force-deletion-of-caches-overriding-default-cache-eviction-policy. After carefully reviewing the setup options for the action, we concluded there is no straight forward way (currently) to achieve this.
The change will also allow us to align our ad-hocs @actions/cache with the default gradle/actions/setup-gradle's behavior, where its cache-read-only (defaulting to ${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}) behaves the same.
Right now, to support our use case, we have been forced to create an internal wrapper composite action that runs @actions/cache/restore or @actions/cache based on this condition.
@actions/cache/save is not fully suitable for the use case, because it does not runs as a post action.
How Has This Been Tested?
A dedicated unit test was added to the saveImpl.test.ts suite.
Test PR in the fork running CI: gmazzo#1
Types of changes
Checklist: