mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2025-11-18 22:41:05 +08:00
* Add glob option to ignore hidden files * Use the basename of the file/directory to check for `.` * Ensure the `excludeHiddenFiles` is properly copied * Allow the root directory to be matched * Fix description of `excludeHiddenFiles` * Document Windows hidden attribute limitation * Bump version * `lint` * Document 0.5.0 release * Lint again
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import * as core from '@actions/core'
|
|
import {GlobOptions} from './internal-glob-options'
|
|
|
|
/**
|
|
* Returns a copy with defaults filled in.
|
|
*/
|
|
export function getOptions(copy?: GlobOptions): GlobOptions {
|
|
const result: GlobOptions = {
|
|
followSymbolicLinks: true,
|
|
implicitDescendants: true,
|
|
matchDirectories: true,
|
|
omitBrokenSymbolicLinks: true,
|
|
excludeHiddenFiles: false
|
|
}
|
|
|
|
if (copy) {
|
|
if (typeof copy.followSymbolicLinks === 'boolean') {
|
|
result.followSymbolicLinks = copy.followSymbolicLinks
|
|
core.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`)
|
|
}
|
|
|
|
if (typeof copy.implicitDescendants === 'boolean') {
|
|
result.implicitDescendants = copy.implicitDescendants
|
|
core.debug(`implicitDescendants '${result.implicitDescendants}'`)
|
|
}
|
|
|
|
if (typeof copy.matchDirectories === 'boolean') {
|
|
result.matchDirectories = copy.matchDirectories
|
|
core.debug(`matchDirectories '${result.matchDirectories}'`)
|
|
}
|
|
|
|
if (typeof copy.omitBrokenSymbolicLinks === 'boolean') {
|
|
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks
|
|
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`)
|
|
}
|
|
|
|
if (typeof copy.excludeHiddenFiles === 'boolean') {
|
|
result.excludeHiddenFiles = copy.excludeHiddenFiles
|
|
core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`)
|
|
}
|
|
}
|
|
|
|
return result
|
|
}
|