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

Output more information about the cache to support overriding default cache eviction policy #1152

Open
ramblingenzyme opened this issue Oct 28, 2024 · 2 comments
Labels
feature request New feature or request to improve the current logic

Comments

@ramblingenzyme
Copy link

ramblingenzyme commented Oct 28, 2024

Description:
In their docs, actions/cache documents a workflow where you use the GitHub CLI to manually delete caches so that your caches on main don't end up being removed.

If cache-primary-key and cache-matched-key outputs were added to match actions/cache/restore (see its action.yml), users could add an optional step to delete the previous cache.

https://github.com/actions/cache/blob/main/tips-and-workarounds.md

steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-node@v4
    id: node
    with:
      cache: yarn

  - name: Cleanup previous Node cache
    if: steps.node.outputs.cache-primary-key != steps.node.outputs.cache-matched-key
    env:
      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    run: |
      gh extension install actions/gh-actions-cache
      
      REPO=${{ github.repository }}
      BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge

      gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm

Justification:
Like #1151 this would give users more flexibility around caching without having to opt out the caching from actions/setup-node.

Are you willing to submit a PR?
If I can find the time

Resources

@ramblingenzyme ramblingenzyme added feature request New feature or request to improve the current logic needs triage labels Oct 28, 2024
@priya-kinthali
Copy link

Hello @ramblingenzyme 👋,
Thank you for this feature request. We will investigate it and get back to you as soon as we have some feedback.

@siam5390
Copy link

siam5390 commented Nov 5, 2024

Yshsbs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

3 participants