@@ -314,7 +314,6 @@ export interface Inputs {
314314 "skip-integrity-check" : boolean ;
315315 "driver-opts" : string [ ] ;
316316 "max-parallelism" : number | null ;
317- "cache-keep-storage" : number ;
318317}
319318
320319async function getInputs ( ) : Promise < Inputs > {
@@ -331,19 +330,6 @@ async function getInputs(): Promise<Inputs> {
331330 }
332331 }
333332
334- const cacheKeepStorageInput = core . getInput ( "cache-keep-storage" ) ;
335- let cacheKeepStorage = 20480 ;
336- if ( cacheKeepStorageInput ) {
337- const parsed = parseInt ( cacheKeepStorageInput , 10 ) ;
338- if ( ! isNaN ( parsed ) && parsed >= 0 ) {
339- cacheKeepStorage = parsed ;
340- } else {
341- core . warning (
342- `Invalid cache-keep-storage value '${ cacheKeepStorageInput } ', ignoring. Must be a non-negative integer (MB). Using default 20480 MB.` ,
343- ) ;
344- }
345- }
346-
347333 return {
348334 "buildx-version" : core . getInput ( "buildx-version" ) ,
349335 "buildkit-version" : core . getInput ( "buildkit-version" ) ,
@@ -356,7 +342,6 @@ async function getInputs(): Promise<Inputs> {
356342 quote : false ,
357343 } ) ,
358344 "max-parallelism" : maxParallelism ,
359- "cache-keep-storage" : cacheKeepStorage ,
360345 } ;
361346}
362347
@@ -579,12 +564,20 @@ async function maybeShutdownBuildkitd(): Promise<void> {
579564
580565 try {
581566 const keepStorageInput = core . getInput ( "cache-keep-storage" ) ;
582- const keepStorageMB = keepStorageInput
583- ? parseInt ( keepStorageInput , 10 )
584- : 20480 ;
585- core . info ( `Pruning BuildKit cache (keep at least ${ keepStorageMB } MB)` ) ;
586- await pruneBuildkitCache ( keepStorageMB ) ;
587- core . info ( "BuildKit cache pruned" ) ;
567+ if ( ! keepStorageInput ) {
568+ core . info ( "Skipping BuildKit cache pruning (cache-keep-storage not set)" ) ;
569+ } else {
570+ const keepStorageMB = parseInt ( keepStorageInput , 10 ) ;
571+ if ( isNaN ( keepStorageMB ) || keepStorageMB < 0 ) {
572+ core . warning (
573+ `Invalid cache-keep-storage value '${ keepStorageInput } ', skipping pruning. Must be a non-negative integer (MB).` ,
574+ ) ;
575+ } else {
576+ core . info ( `Pruning BuildKit cache (keep at least ${ keepStorageMB } MB)` ) ;
577+ await pruneBuildkitCache ( keepStorageMB ) ;
578+ core . info ( "BuildKit cache pruned" ) ;
579+ }
580+ }
588581 } catch ( error ) {
589582 core . warning ( `Error pruning BuildKit cache: ${ ( error as Error ) . message } ` ) ;
590583 }
0 commit comments