actions / actions/cache

Exclusions do not work

Open
#1,356 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Exclusions do not work.

Example:

jobs:
  save:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/cache@v3
      with:
        path: |
          cache
          !cache/unwanted
        key: ${{ github.workflow }}/${{ github.run_number }}-${{ github.run_attempt }}
    - run: |
        mkdir -p cache/wanted cache/unwanted
        > cache/wanted/example.txt
        > cache/unwanted/example.txt
  restore:
    needs: [save]
    runs-on: ubuntu-latest
    steps:
    - uses: actions/cache@v3
      with:
        fail-on-cache-miss: true
        path: |
          cache
          !cache/unwanted
        key: ${{ github.workflow }}/${{ github.run_number }}-${{ github.run_attempt }}
    - run: find cache > "$GITHUB_STEP_SUMMARY"
on: workflow_dispatch
name: Example

Outputs:

cache
cache/wanted
cache/wanted/example.txt
cache/unwanted
cache/unwanted/example.txt

Reference: https://github.com/actions/cache/blob/67b839edb68371cc5014f6cea11c9aa77238de78/examples.md#c---nuget


See #1215

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the workflow shown in the issue and compare the resulting cache contents with the expected exclusion. Read the referenced examples.md section and issue #1215 for context, then trace the cache path handling. Done means paths such as cache/unwanted are excluded during save and restore while cache/wanted remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.