mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2025-11-20 00:31:06 +08:00
* Added verbose mode in hashFiles * Code formatting * Change verboseMode arg to verbose Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> * Using verbose instead of verboseMode as arg Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com>
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import {Globber, DefaultGlobber} from './internal-globber'
|
|
import {GlobOptions} from './internal-glob-options'
|
|
import {HashFileOptions} from './internal-hash-file-options'
|
|
import {hashFiles as _hashFiles} from './internal-hash-files'
|
|
|
|
export {Globber, GlobOptions}
|
|
|
|
/**
|
|
* Constructs a globber
|
|
*
|
|
* @param patterns Patterns separated by newlines
|
|
* @param options Glob options
|
|
*/
|
|
export async function create(
|
|
patterns: string,
|
|
options?: GlobOptions
|
|
): Promise<Globber> {
|
|
return await DefaultGlobber.create(patterns, options)
|
|
}
|
|
|
|
/**
|
|
* Computes the sha256 hash of a glob
|
|
*
|
|
* @param patterns Patterns separated by newlines
|
|
* @param options Glob options
|
|
*/
|
|
export async function hashFiles(
|
|
patterns: string,
|
|
options?: HashFileOptions,
|
|
verbose: Boolean = false
|
|
): Promise<string> {
|
|
let followSymbolicLinks = true
|
|
if (options && typeof options.followSymbolicLinks === 'boolean') {
|
|
followSymbolicLinks = options.followSymbolicLinks
|
|
}
|
|
const globber = await create(patterns, {followSymbolicLinks})
|
|
return _hashFiles(globber, verbose)
|
|
}
|