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

How can I prevent storing cache for pull request branches #1551

Open
amarBitMan opened this issue Feb 12, 2025 · 2 comments
Open

How can I prevent storing cache for pull request branches #1551

amarBitMan opened this issue Feb 12, 2025 · 2 comments
Labels
question Further information is requested

Comments

@amarBitMan
Copy link

I want the cache to be restored and used across all pull request workflows. However, if a pull request introduces changes that modify the cache key, I want to prevent the new value from being stored in the cache.

@joshmgross joshmgross added the question Further information is requested label Feb 12, 2025
@NishantBansal2003
Copy link

Hey, are there any leads on this? I've encountered the same problem and would be happy to receive a solution, or has this not been implemented yet?

@NishantBansal2003
Copy link

I want the cache to be restored and used across all pull request workflows. However, if a pull request introduces changes that modify the cache key, I want to prevent the new value from being stored in the cache.

I was digging around, and it looks like this is the solution: https://github.com/actions/cache/blob/main/caching-strategies.md#saving-cache. With using a simple if statement on the save step: github.event_name != 'pull_request'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants