@@ -25,6 +25,9 @@ inputs:
2525  mode :
2626    description : Cache mode 
2727    default : max 
28+   cache_to_name :
29+     description : ' Save cache to name manifest (should be used only on default branch)' 
30+     default : ' false' 
2831
2932outputs :
3033  cache_to :
4144      id : script 
4245      with :
4346        script : | 
44-           const sanitizedHeadRef = '${{ inputs.head_ref }}'.replace(/[^a-zA-Z0-9]/g, '-'); 
45- 
46-           const manifestNames = [ 
47-             '${{ inputs.name }}_sha_${{ github.sha }}', 
48-             `${{ inputs.name }}_tag_${ sanitizedHeadRef }`, 
49-             '${{ inputs.name }}' // TODO: must be only on default branch 
50-           ]; 
51- 
5247          const settings = { 
5348            type: 's3', 
5449            region: '${{ inputs.region }}', 
6156            .map(([key, value]) => `${key}=${value}`) 
6257            .join(','); 
6358
64-           const cacheFrom = manifestNames 
59+           const sanitizedHeadRef = '${{ inputs.head_ref }}'.replace(/[^a-zA-Z0-9]/g, '-'); 
60+ 
61+           const shaManifestName = '${{ inputs.name }}_sha_${{ github.sha }}'; 
62+           const headRefManifestName = '${{ inputs.name }}_tag_${ sanitizedHeadRef }'; 
63+ 
64+           const cacheFromManifestNames = [ 
65+             shaManifestName, 
66+             headRefManifestName, 
67+             '${{ inputs.name }}', 
68+           ]; 
69+ 
70+           const cacheFrom = cacheFromManifestNames 
6571            .map((name) => `${settingsString},name=${name}`) 
6672            .join('\n'); 
6773
6874          core.setOutput('cache_from', cacheFrom); 
75+ 
76+           const cacheToManifestNames = [ 
77+             shaManifestName, 
78+             headRefManifestName, 
79+           ]; 
80+            
81+           if ('${{ inputs.cache_to_name }}' === 'true') { 
82+             cacheToManifestNames.push('${{ inputs.name }}'); 
83+           } 
84+ 
6985          core.setOutput('cache_to', `${settingsString},mode=${{ inputs.mode }},name=${manifestNames.join(';')}`); 
0 commit comments