-
Couldn't load subscription status.
- Fork 1.6k
Description
Describe the bug
Accroding to C# - NuGet example in actions/cache, @actions/cache should support exclude pattern like this:
['~/.nuget/packages', '!~/.nuget/packages/unwanted']But saveCacheV2() use resolvePaths() here:
toolkit/packages/cache/src/cache.ts
Line 533 in ddc5fa4
| const cachePaths = await utils.resolvePaths(paths) |
and
resolvePaths() simply ignore all exclude pattern.toolkit/packages/cache/src/internal/cacheUtils.ts
Lines 51 to 53 in ddc5fa4
| const globber = await glob.create(patterns.join('\n'), { | |
| implicitDescendants: false | |
| }) |
To Reproduce
import cache from '@actions/cache/lib/internal/cacheUtils.js'
console.log(await cache.resolvePaths(['~/.nuget/packages', '!~/.nuget/packages/unwanted']))
// [ '~/.nuget/packages' ]or run an actions (example from actions/cache):
- uses: actions/cache@v4
with:
path: |
~/.nuget/packages
!~/.nuget/packages/unwanted
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-Expected behavior
Respect exclude patterns and ignore ~/.nuget/packages/unwanted.
Screenshots
Desktop (please complete the following information):
- OS: Ubuntu 24.04 (GitHub-hosted runners)
- Browser irrelevant
- Version irrelevant
Smartphone (please complete the following information):
- Device: irrelevant
- OS: irrelevant
- Browser irrelevant
- Version irrelevant
Additional context
Here is a real world example:
workflows file
actions debug log
you can see pattern !/tmp/.xmake/**/.git was ignored and actions tried to cache .git file which it doesn't have proper permission to read.