File tree Expand file tree Collapse file tree 3 files changed +40
-2
lines changed Expand file tree Collapse file tree 3 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,22 @@ See `extraFiles` for more details.
100100
101101The content of `extraHashedContent` is taken into account in the hash for the coursier cache key.
102102
103+ # ## `ignoreJob`
104+
105+ *Optional*
106+
107+ Default : ` false`
108+
109+ Set `true` if you don't want to use a job id as part of cache key.
110+
111+ # ## `ignoreMatrix`
112+
113+ *Optional*
114+
115+ Default : ` false`
116+
117+ Set `true` if you don't want to use a matrix jobs as part of cache key.
118+
103119# # Outputs
104120
105121* `cache-hit-coursier` - A boolean value to indicate a match was found for the coursier cache
Original file line number Diff line number Diff line change @@ -109,6 +109,16 @@ inputs:
109109 description : >
110110 Extra content to take into account in the Ammonite cache key. Same format as extraHashedContent.
111111 default : ' '
112+ ignoreJob :
113+ required : false
114+ description : >
115+ Set 'true' if you don't want to use a job id as part of cache key.
116+ default : ' false'
117+ ignoreMatrix :
118+ required : false
119+ description : >
120+ Set 'true' if you don't want to use a matrix jobs as part of cache key.
121+ default : ' false'
112122outputs :
113123 cache-hit-coursier :
114124 description : ' A boolean value to indicate a match was found for the coursier cache'
Original file line number Diff line number Diff line change @@ -300,6 +300,10 @@ function readExtraKeys(variableName: string): string {
300300 return extraFilesStr
301301}
302302
303+ function readExtraBoolean ( variableName : string ) : boolean {
304+ return core . getBooleanInput ( variableName , { required : false } )
305+ }
306+
303307async function run ( ) : Promise < void > {
304308 let root = core . getInput ( 'root' )
305309 if ( ! root . endsWith ( '/' ) ) {
@@ -345,9 +349,17 @@ async function run(): Promise<void> {
345349 const extraMillKey = readExtraKeys ( 'extraMillKey' )
346350 const extraAmmoniteKey = readExtraKeys ( 'extraAmmoniteKey' )
347351
348- const job = readExtraKeys ( 'job' )
352+ const ignoreJobAsPartCacheKey = readExtraBoolean ( 'ignoreJob' )
353+ const ignoreMatrixAsPartCacheKey = readExtraBoolean ( 'ignoreMatrix' )
354+
355+ const job = ignoreJobAsPartCacheKey ? '' : readExtraKeys ( 'job' )
349356 let matrix = readExtraKeys ( 'matrix' )
350- if ( matrix === 'null' || matrix === 'undefined' || matrix === '{}' ) {
357+ if (
358+ matrix === 'null' ||
359+ matrix === 'undefined' ||
360+ matrix === '{}' ||
361+ ignoreMatrixAsPartCacheKey
362+ ) {
351363 matrix = ''
352364 }
353365
You can’t perform that action at this time.
0 commit comments