Skip to content

Add cache-save: false option#762

Open
akx wants to merge 3 commits into
actions:mainfrom
akx:no-save-cache-options
Open

Add cache-save: false option#762
akx wants to merge 3 commits into
actions:mainfrom
akx:no-save-cache-options

Conversation

@akx

@akx akx commented Nov 10, 2023

Copy link
Copy Markdown
Contributor

Description

This PR adds a new cache-save: false option to opt out of saving the cache. As described in the documentation:

For some scenarios, it may be useful to only save a given subset of dependencies,
but restore more of them for other workflows. For instance, there may be a heavy
extras dependency that you do not need your entire test matrix to download, but
you want to download and test it separately without it being saved in the cache
archive for all runs.

To achieve this, you can use cache-save: false on the run that uses the heavy
dependency.

Related issue

I only found the related issue after implementing this: #751.

Check list

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@akx
akx requested a review from a team as a code owner November 10, 2023 08:30
@akx
akx force-pushed the no-save-cache-options branch from 346329c to 59d62e4 Compare November 10, 2023 13:35
@akx
akx force-pushed the no-save-cache-options branch from 59d62e4 to 8f0a0b0 Compare December 12, 2023 13:27
@akx

akx commented Dec 12, 2023

Copy link
Copy Markdown
Contributor Author

Rebased on v5.

@dmitry-shibanov Could you review this, please?

@ozancaglayan

Copy link
Copy Markdown

Could someone please take an action for this PR and release a new version? 🙏

@ozancaglayan

Copy link
Copy Markdown

@akx can you request review from the maintainers here? @priya-kinthali @aparnajyothi-y @HarithaVattikuti

@akx

akx commented Oct 10, 2024

Copy link
Copy Markdown
Contributor Author

@ozancaglayan As an external, I have no option to request a reviewer. GitHub does say "actions/setup-actions-team was requested for review"...

kdeldycke added a commit to kdeldycke/repomatic that referenced this pull request Dec 24, 2024
@aparnajyothi-y

aparnajyothi-y commented Dec 30, 2024

Copy link
Copy Markdown
Contributor

Hello Everyone, Thank you for your contribution with this PR.
While we appreciate the idea, we’re concerned that it may introduce additional complexity and could potentially limit caching benefits. Furthermore, it would require ongoing maintenance and updates to documentation. Given these factors, we’ve decided to not move forward with this change at this time.

We truly appreciate your understanding and patience, and we encourage you to continue sharing any further thoughts or suggestions you may have.

@aparnajyothi-y

Copy link
Copy Markdown
Contributor

Hello @akx, Please let us know if you still need any more clarifications/concerns on the above.

@akx

akx commented Jan 22, 2025

Copy link
Copy Markdown
Contributor Author

[...] we’re concerned that it may introduce additional complexity

It's opt-in, for corner cases as described in the PR description.

and could potentially limit caching benefits.

Yes, perfectly on purpose, as described in the PR description.

Furthermore, it would require ongoing maintenance and updates to documentation.

Any change or improvement does that, really. Do note that this PR does have tests and documentation included.

@aparnajyothi-y Feel free to close this if you still believe it's not welcome.

@medmunds

medmunds commented Apr 4, 2025

Copy link
Copy Markdown

This would also allow using the cache while avoiding cache poisoning vulnerabilities from PRs:

    - uses: actions/setup-python@v5
      with:
        python-version: "3.13"
        cache: "pip"
        # For anything PR-related, treat the cache as restore-only:
        cache-save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

Without this option, workflow security audits currently recommend removing cache: from actions/setup-python (which does in fact "limit caching benefits") and/or manually coding separate actions/cache/save and actions/cache/restore with appropriate conditions (which does in fact "introduce additional complexity").

@akx

akx commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

For people following at home, actions/setup-uv just added this in tag 6.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants