mirror of
				https://code.forgejo.org/actions/cache.git
				synced 2025-10-31 12:42:28 +00:00 
			
		
		
		
	Add new setting save-on-success.
* Proposal to implement https://github.com/actions/cache/issues/1570
This commit is contained in:
		
							parent
							
								
									d4323d4df1
								
							
						
					
					
						commit
						b38d23e36a
					
				
					 2 changed files with 8 additions and 2 deletions
				
			
		|  | @ -76,6 +76,7 @@ If you are using a `self-hosted` Windows runner, `GNU tar` and `zstd` are requir | ||||||
| * `enableCrossOsArchive` - An optional boolean when enabled, allows Windows runners to save or restore caches that can be restored or saved respectively on other platforms. Default: `false` | * `enableCrossOsArchive` - An optional boolean when enabled, allows Windows runners to save or restore caches that can be restored or saved respectively on other platforms. Default: `false` | ||||||
| * `fail-on-cache-miss` - Fail the workflow if cache entry is not found. Default: `false` | * `fail-on-cache-miss` - Fail the workflow if cache entry is not found. Default: `false` | ||||||
| * `lookup-only` - If true, only checks if cache entry exists and skips download. Does not change save cache behavior. Default: `false` | * `lookup-only` - If true, only checks if cache entry exists and skips download. Does not change save cache behavior. Default: `false` | ||||||
|  | * `save-on-success` - If true, then the cache is written in the post action on success, or (if false) the cache will only be restored if available. | ||||||
| 
 | 
 | ||||||
| #### Environment Variables | #### Environment Variables | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -26,13 +26,18 @@ inputs: | ||||||
|     description: 'Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache' |     description: 'Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache' | ||||||
|     default: 'false' |     default: 'false' | ||||||
|     required: false |     required: false | ||||||
|  |   save-on-success: | ||||||
|  |     description: 'Whether the cache is written in the post action on success or (if false) is only restored' | ||||||
|  |     default: 'true' | ||||||
|  |     required: false | ||||||
|   save-always: |   save-always: | ||||||
|     description: 'Run the post step to save the cache even if another step before fails' |     description: 'Run the post step to save the cache even if another step before fails' | ||||||
|     default: 'false' |     default: 'false' | ||||||
|     required: false |     required: false | ||||||
|     deprecationMessage: | |     deprecationMessage: | | ||||||
|       save-always does not work as intended and will be removed in a future release. |       save-always does not work as intended and will be removed in a future release. | ||||||
|       A separate `actions/cache/restore` step should be used instead. |       If you only want to control whether a new cache will be written use `save-always` instead. | ||||||
|  |       Otherwise a separate `actions/cache/restore` step should be used instead. | ||||||
|       See https://github.com/actions/cache/tree/main/save#always-save-cache for more details. |       See https://github.com/actions/cache/tree/main/save#always-save-cache for more details. | ||||||
| outputs: | outputs: | ||||||
|   cache-hit: |   cache-hit: | ||||||
|  | @ -41,7 +46,7 @@ runs: | ||||||
|   using: 'node20' |   using: 'node20' | ||||||
|   main: 'dist/restore/index.js' |   main: 'dist/restore/index.js' | ||||||
|   post: 'dist/save/index.js' |   post: 'dist/save/index.js' | ||||||
|   post-if: "success()" |   post-if: "success() && github.event.inputs.save-on-success" | ||||||
| branding: | branding: | ||||||
|   icon: 'archive' |   icon: 'archive' | ||||||
|   color: 'gray-dark' |   color: 'gray-dark' | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue