1
0
Fork 0
mirror of https://github.com/actions/upload-artifact synced 2024-12-22 06:22:45 +00:00

Update to latest @actions/glob and fix tests

This commit is contained in:
Josh Gross 2024-08-15 17:26:43 -04:00
parent acb59e4776
commit a0c40cf602
No known key found for this signature in database
4 changed files with 24 additions and 26 deletions

View file

@ -61,13 +61,13 @@ const lonelyFilePath = path.join(
'lonely-file.txt' 'lonely-file.txt'
) )
const hiddenFile = path.join(root, '.hidden-file.txt')
const fileInHiddenFolderPath = path.join( const fileInHiddenFolderPath = path.join(
root, root,
'.hidden-folder', '.hidden-folder',
'folder-in-hidden-folder', 'folder-in-hidden-folder',
'file.txt' 'file.txt'
) )
const hiddenFile = path.join(root, '.hidden-file.txt')
const fileInHiddenFolderInFolderA = path.join( const fileInHiddenFolderInFolderA = path.join(
root, root,
'folder-a', 'folder-a',
@ -132,6 +132,10 @@ describe('Search', () => {
await fs.writeFile(amazingFileInFolderHPath, 'amazing file') await fs.writeFile(amazingFileInFolderHPath, 'amazing file')
await fs.writeFile(lonelyFilePath, 'all by itself') await fs.writeFile(lonelyFilePath, 'all by itself')
await fs.writeFile(hiddenFile, 'hidden file')
await fs.writeFile(fileInHiddenFolderPath, 'file in hidden directory')
await fs.writeFile(fileInHiddenFolderInFolderA, 'file in hidden directory')
/* /*
Directory structure of files that get created: Directory structure of files that get created:
root/ root/
@ -385,25 +389,19 @@ describe('Search', () => {
const searchPath = path.join(root, '**/*') const searchPath = path.join(root, '**/*')
const searchResult = await findFilesToUpload(searchPath) const searchResult = await findFilesToUpload(searchPath)
expect(searchResult.filesToUpload.includes(hiddenFile)).toEqual(false) expect(searchResult.filesToUpload).not.toContain(hiddenFile)
expect(searchResult.filesToUpload.includes(fileInHiddenFolderPath)).toEqual( expect(searchResult.filesToUpload).not.toContain(fileInHiddenFolderPath)
false expect(searchResult.filesToUpload).not.toContain(
fileInHiddenFolderInFolderA
) )
expect(
searchResult.filesToUpload.includes(fileInHiddenFolderInFolderA)
).toEqual(false)
}) })
it('Hidden files included', async () => { it('Hidden files included', async () => {
const searchPath = path.join(root, '**/*') const searchPath = path.join(root, '**/*')
const searchResult = await findFilesToUpload(searchPath, true) const searchResult = await findFilesToUpload(searchPath, true)
expect(searchResult.filesToUpload.includes(hiddenFile)).toEqual(false) expect(searchResult.filesToUpload).toContain(hiddenFile)
expect(searchResult.filesToUpload.includes(fileInHiddenFolderPath)).toEqual( expect(searchResult.filesToUpload).toContain(fileInHiddenFolderPath)
false expect(searchResult.filesToUpload).toContain(fileInHiddenFolderInFolderA)
)
expect(
searchResult.filesToUpload.includes(fileInHiddenFolderInFolderA)
).toEqual(false)
}) })
}) })

18
package-lock.json generated
View file

@ -12,7 +12,7 @@
"@actions/artifact": "2.1.8", "@actions/artifact": "2.1.8",
"@actions/core": "^1.10.1", "@actions/core": "^1.10.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"@actions/glob": "^0.3.0", "@actions/glob": "^0.5.0",
"@actions/io": "^1.1.2", "@actions/io": "^1.1.2",
"minimatch": "^9.0.3" "minimatch": "^9.0.3"
}, },
@ -191,11 +191,11 @@
} }
}, },
"node_modules/@actions/glob": { "node_modules/@actions/glob": {
"version": "0.3.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz", "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.0.tgz",
"integrity": "sha512-tJP1ZhF87fd6LBnaXWlahkyvdgvsLl7WnreW1EZaC8JWjpMXmzqWzQVe/IEYslrkT9ymibVrKyJN4UMD7uQM2w==", "integrity": "sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.9.1",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"
} }
}, },
@ -8036,11 +8036,11 @@
} }
}, },
"@actions/glob": { "@actions/glob": {
"version": "0.3.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz", "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.0.tgz",
"integrity": "sha512-tJP1ZhF87fd6LBnaXWlahkyvdgvsLl7WnreW1EZaC8JWjpMXmzqWzQVe/IEYslrkT9ymibVrKyJN4UMD7uQM2w==", "integrity": "sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==",
"requires": { "requires": {
"@actions/core": "^1.2.6", "@actions/core": "^1.9.1",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"
}, },
"dependencies": { "dependencies": {

View file

@ -32,7 +32,7 @@
"@actions/artifact": "2.1.8", "@actions/artifact": "2.1.8",
"@actions/core": "^1.10.1", "@actions/core": "^1.10.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"@actions/glob": "^0.3.0", "@actions/glob": "^0.5.0",
"@actions/io": "^1.1.2", "@actions/io": "^1.1.2",
"minimatch": "^9.0.3" "minimatch": "^9.0.3"
}, },

View file

@ -11,12 +11,12 @@ export interface SearchResult {
rootDirectory: string rootDirectory: string
} }
function getDefaultGlobOptions(_includeHiddenFiles: boolean): glob.GlobOptions { function getDefaultGlobOptions(includeHiddenFiles: boolean): glob.GlobOptions {
return { return {
followSymbolicLinks: true, followSymbolicLinks: true,
implicitDescendants: true, implicitDescendants: true,
omitBrokenSymbolicLinks: true, omitBrokenSymbolicLinks: true,
// excludeHiddenFiles: !includeHiddenFiles, excludeHiddenFiles: !includeHiddenFiles,
} }
} }