Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions patches/@actions__glob@0.7.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- a/lib/internal-pattern.js
+++ b/lib/internal-pattern.js
@@ -97,11 +97,11 @@
partialMatch(itemPath) {
// Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
- // matchOne does not handle root path correctly
+ // Keep the root check separate from partial path matching
if (pathHelper.dirname(itemPath) === itemPath) {
return this.rootRegExp.test(itemPath);
}
- return this.minimatch.matchOne(itemPath.split(IS_WINDOWS ? /\\+/ : /\/+/), this.minimatch.set[0], true);
+ return this.minimatch.match(itemPath, true);
}
/**
* Escapes glob patterns within a path
16 changes: 4 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ packageExtensions:
dependencies:
"@protobuf-ts/runtime": "^2.11.1"
overrides:
# The Actions glob walker calls Minimatch.matchOne, which v11 removed.
"@actions/glob@0.7.0>minimatch": "10.2.6"
"@humanfs/node": "0.16.8"
"@octokit/graphql": "$@octokit/graphql"
"@octokit/request-error": "$@octokit/request-error"
Expand Down Expand Up @@ -88,6 +86,7 @@ overrides:
"yaml": "2.8.1"
"yargs-parser": "$yargs-parser"
patchedDependencies:
"@actions/glob@0.7.0": "patches/@actions__glob@0.7.0.patch"
"@socketregistry/packageurl-js@1.7.0": "patches/@socketregistry__packageurl-js@1.7.0.patch"
"@socketsecurity/sdk@4.3.0": "patches/@socketsecurity__sdk@4.3.0.patch"
"@cyclonedx/cdxgen@12.9.2": "patches/@cyclonedx__cdxgen@12.9.2.patch"
Expand Down
28 changes: 27 additions & 1 deletion test/unit/github/actions/repo/cache-downloads/index.test.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mkdtemp, readFile, rm } from 'node:fs/promises'
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import path from 'node:path'

Expand Down Expand Up @@ -50,6 +50,32 @@ describe('SEA download cache action', () => {
}
})

it('resolves cache directories and nested files with the installed Actions glob', async () => {
// Exercise the same resolver that saveCache uses before it uploads an archive.
const { resolvePaths } = await import(
new URL('./internal/cacheUtils.js', import.meta.resolve('@actions/cache'))
.href
)
const workspace = await mkdtemp(path.join(tmpdir(), 'sea-cache-paths-'))
vi.stubEnv('GITHUB_WORKSPACE', workspace)
try {
const blobs = path.join(workspace, 'blobs')
const shard = path.join(blobs, 'shard')
await mkdir(shard, { recursive: true })
await writeFile(path.join(shard, 'entry'), '')
await writeFile(path.join(shard, 'skip'), '')
expect(await resolvePaths([blobs])).toEqual(['blobs'])
expect(
await resolvePaths([
path.join(blobs, '*', '*'),
'!' + path.join(shard, 'skip'),
]),
).toEqual(['blobs/shard/entry'])
} finally {
await rm(workspace, { force: true, recursive: true })
}
})

it('limits the cache path to content-addressed blobs', () => {
const home = path.join(path.parse(process.cwd()).root, 'home', 'runner')
const blobs = path.join(
Expand Down
Loading