File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -26,12 +26,13 @@ export async function create(
2626 */
2727export async function hashFiles (
2828 patterns : string ,
29- options ?: HashFileOptions
29+ options ?: HashFileOptions ,
30+ verbose : Boolean = false
3031) : Promise < string > {
3132 let followSymbolicLinks = true
3233 if ( options && typeof options . followSymbolicLinks === 'boolean' ) {
3334 followSymbolicLinks = options . followSymbolicLinks
3435 }
3536 const globber = await create ( patterns , { followSymbolicLinks} )
36- return _hashFiles ( globber )
37+ return _hashFiles ( globber , verbose )
3738}
Original file line number Diff line number Diff line change @@ -6,19 +6,23 @@ import * as util from 'util'
66import * as path from 'path'
77import { Globber } from './glob'
88
9- export async function hashFiles ( globber : Globber ) : Promise < string > {
9+ export async function hashFiles (
10+ globber : Globber ,
11+ verbose : Boolean = false
12+ ) : Promise < string > {
13+ const writeDelegate = verbose ? core . info : core . debug
1014 let hasMatch = false
1115 const githubWorkspace = process . env [ 'GITHUB_WORKSPACE' ] ?? process . cwd ( )
1216 const result = crypto . createHash ( 'sha256' )
1317 let count = 0
1418 for await ( const file of globber . globGenerator ( ) ) {
15- core . debug ( file )
19+ writeDelegate ( file )
1620 if ( ! file . startsWith ( `${ githubWorkspace } ${ path . sep } ` ) ) {
17- core . debug ( `Ignore '${ file } ' since it is not under GITHUB_WORKSPACE.` )
21+ writeDelegate ( `Ignore '${ file } ' since it is not under GITHUB_WORKSPACE.` )
1822 continue
1923 }
2024 if ( fs . statSync ( file ) . isDirectory ( ) ) {
21- core . debug ( `Skip directory '${ file } '.` )
25+ writeDelegate ( `Skip directory '${ file } '.` )
2226 continue
2327 }
2428 const hash = crypto . createHash ( 'sha256' )
@@ -33,10 +37,10 @@ export async function hashFiles(globber: Globber): Promise<string> {
3337 result . end ( )
3438
3539 if ( hasMatch ) {
36- core . debug ( `Found ${ count } files to hash.` )
40+ writeDelegate ( `Found ${ count } files to hash.` )
3741 return result . digest ( 'hex' )
3842 } else {
39- core . debug ( `No matches found for glob` )
43+ writeDelegate ( `No matches found for glob` )
4044 return ''
4145 }
4246}
You can’t perform that action at this time.
0 commit comments