File tree Expand file tree Collapse file tree 1 file changed +28
-10
lines changed Expand file tree Collapse file tree 1 file changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export async function runCommand({
25
25
shouldCacheOnError,
26
26
} : RunCommandProps ) {
27
27
if ( ! cacheByTime && cacheByFiles . length === 0 ) {
28
+ console . log ( `Executing command "${ command } " due to no caching options provided` )
28
29
await execSh . promise ( command )
29
30
return
30
31
}
@@ -56,28 +57,45 @@ export async function runCommand({
56
57
} ) ( )
57
58
58
59
if ( areFileHashesEqual && isWithinCacheTime ) {
60
+ console . log (
61
+ [
62
+ `Skipping command "${ command } " due to` ,
63
+ [ fileHashes && 'unchanged files' , duration && 'being within cache time' ]
64
+ . filter ( Boolean )
65
+ . join ( ' and ' ) ,
66
+ ] . join ( ' ' )
67
+ )
59
68
return
60
69
}
61
70
71
+ console . log (
72
+ [
73
+ `Executing command "${ command } " due to` ,
74
+ [ fileHashes && 'changed files' , duration && 'cache time passing' ]
75
+ . filter ( Boolean )
76
+ . join ( ' and ' ) ,
77
+ ] . join ( ' ' )
78
+ )
62
79
let execPromise = execSh . promise ( command )
63
80
81
+ function setCache ( ) {
82
+ cache . setKey ( cacheKey , {
83
+ lastRun : currentDate ,
84
+ fileHashes,
85
+ } )
86
+ cache . save ( true )
87
+ console . log ( `Cache saved for command "${ command } "` )
88
+ }
89
+
64
90
if ( shouldCacheOnError ) {
65
91
execPromise = execPromise . catch ( ( error : unknown ) => {
66
- cache . setKey ( cacheKey , {
67
- lastRun : currentDate ,
68
- fileHashes,
69
- } )
70
- cache . save ( true )
92
+ setCache ( )
71
93
72
94
throw error
73
95
} )
74
96
}
75
97
76
98
await execPromise
77
99
78
- cache . setKey ( cacheKey , {
79
- lastRun : currentDate ,
80
- fileHashes,
81
- } )
82
- cache . save ( true )
100
+ setCache ( )
83
101
}
You can’t perform that action at this time.
0 commit comments