mirror of
https://code.forgejo.org/actions/upload-artifact.git
synced 2025-05-22 08:54:47 +00:00
Warn excluded hidden files
This commit is contained in:
parent
6027e3dd17
commit
ac7ab52308
2 changed files with 28 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
import * as glob from '@actions/glob'
|
||||
import * as path from 'path'
|
||||
import {debug, info} from '@actions/core'
|
||||
import {debug, info, warning} from '@actions/core'
|
||||
import {stat} from 'fs'
|
||||
import {dirname} from 'path'
|
||||
import {promisify} from 'util'
|
||||
|
@ -90,6 +90,27 @@ export async function findFilesToUpload(
|
|||
)
|
||||
const rawSearchResults: string[] = await globber.glob()
|
||||
|
||||
/*
|
||||
Check for hidden files by comparing results with includeHiddenFiles=true
|
||||
*/
|
||||
if (!includeHiddenFiles) {
|
||||
const globberWithHidden = await glob.create(
|
||||
searchPath,
|
||||
getDefaultGlobOptions(true)
|
||||
)
|
||||
const rawSearchResultsWithHidden = await globberWithHidden.glob()
|
||||
|
||||
const hiddenFiles = rawSearchResultsWithHidden.filter(
|
||||
file => !rawSearchResults.includes(file)
|
||||
)
|
||||
|
||||
if (hiddenFiles.length > 0) {
|
||||
warning(
|
||||
`The path "${searchPath}" excluded ${hiddenFiles.length} hidden files. Set include-hidden-files to true to include these files.`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Files are saved with case insensitivity. Uploading both a.txt and A.txt will files to be overwritten
|
||||
Detect any files that could be overwritten for user awareness
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue