mirror of
				https://github.com/actions/cache.git
				synced 2025-11-01 04:28:39 +08:00 
			
		
		
		
	Compare commits
	
		
			81 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 0057852bfa | ||
|   | 4f5ea67f1c | ||
|   | 9fcad95d03 | ||
|   | 638ed79f9d | ||
|   | 3862dccb17 | ||
|   | 0400d5f644 | ||
|   | 374a27f269 | ||
|   | 358a7306cd | ||
|   | 2ee706ef74 | ||
|   | 94f7b5d913 | ||
|   | c36116c3f4 | ||
|   | 320fe7d56b | ||
|   | d81cc477d9 | ||
|   | de243982c5 | ||
|   | e7b6a9cc9d | ||
|   | 640a1c2554 | ||
|   | c45d39173a | ||
|   | 5a3ec84eff | ||
|   | 7de21022a7 | ||
|   | 76d40dd347 | ||
|   | 76dd5eb692 | ||
|   | 8c80c27c5e | ||
|   | 45cfd0e7ff | ||
|   | edd449b9cf | ||
|   | 0576707e37 | ||
|   | 3105dc9754 | ||
|   | 9450d42d15 | ||
|   | 7d05b27fb9 | ||
|   | 507b84c6a6 | ||
|   | f248408e15 | ||
|   | c30eb5542e | ||
|   | 5b6ae99d8b | ||
|   | eca7c65a55 | ||
|   | 1b5d75f5cf | ||
|   | d4323d4df1 | ||
|   | da26677639 | ||
|   | 7921ae235b | ||
|   | 3937731706 | ||
|   | 0c907a75c2 | ||
|   | 710893c236 | ||
|   | 9fa7e61ec7 | ||
|   | 36f1e144e1 | ||
|   | 53aa38c736 | ||
|   | 1bd1e32a3b | ||
|   | 882d7ced4c | ||
|   | f2695d7a42 | ||
|   | f46ceeb60d | ||
|   | e6f5858749 | ||
|   | 4ae6f21c0d | ||
|   | c16df86586 | ||
|   | b109c12f3b | ||
|   | b7d227d702 | ||
|   | faf639248d | ||
|   | 4bc41c01bd | ||
|   | 6849a64899 | ||
|   | 5a1720c49e | ||
|   | d9fef48d24 | ||
|   | a50e8d027b | ||
|   | acc9ae5c14 | ||
|   | 1ea5f18c31 | ||
|   | cc679ff3ba | ||
|   | 366d43d6f8 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 02bf31969b | ||
|   | 6f6220be5a | ||
|   | ebdd24ede1 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 255c8ff306 | ||
|   | 010f24cd9d | ||
|   | d6151ba7db | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 4ca7071576 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 5d692d65f4 | ||
|   | 3aef79d3a3 | ||
|   | aa55e5f344 | ||
|   | 772385291f | ||
|   | e5dc90df92 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 8585f2ac5c | ||
|   | 9803087a86 | ||
|   | e7e2547a88 | ||
|   | 71d826cc33 | ||
|   | 25942a73ac | ||
|   | d73025053b | ||
|   | 8469c94c6a | 
							
								
								
									
										22
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| # To get started with Dependabot version updates, you'll need to specify which | ||||
| # package ecosystems to update and where the package manifests are located. | ||||
| # Please see the documentation for all configuration options: | ||||
| # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||||
| 
 | ||||
| version: 2 | ||||
| updates: | ||||
|   - package-ecosystem: "github-actions" | ||||
|     directory: "/" | ||||
|     schedule: | ||||
|       interval: "weekly" | ||||
|     groups: | ||||
|       minor-actions-dependencies: | ||||
|         update-types: [minor, patch] | ||||
|    | ||||
|   - package-ecosystem: "npm" | ||||
|     directory: "/" | ||||
|     schedule: | ||||
|       interval: "daily"  | ||||
|     allow: | ||||
|     - dependency-type: direct | ||||
|     - dependency-type: production | ||||
							
								
								
									
										2
									
								
								.github/workflows/close-inactive-issues.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/close-inactive-issues.yml
									
									
									
									
										vendored
									
									
								
							|  | @ -10,7 +10,7 @@ jobs: | |||
|       issues: write | ||||
|       pull-requests: write | ||||
|     steps: | ||||
|       - uses: actions/stale@v3 | ||||
|       - uses: actions/stale@v9 | ||||
|         with: | ||||
|           days-before-issue-stale: 200 | ||||
|           days-before-issue-close: 5 | ||||
|  |  | |||
							
								
								
									
										8
									
								
								.github/workflows/codeql.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/codeql.yml
									
									
									
									
										vendored
									
									
								
							|  | @ -17,11 +17,11 @@ jobs: | |||
| 
 | ||||
|     steps: | ||||
|     - name: Checkout repository | ||||
|       uses: actions/checkout@v3 | ||||
|       uses: actions/checkout@v4 | ||||
| 
 | ||||
|     # Initializes the CodeQL tools for scanning. | ||||
|     - name: Initialize CodeQL | ||||
|       uses: github/codeql-action/init@v2 | ||||
|       uses: github/codeql-action/init@v3 | ||||
|       # Override language selection by uncommenting this and choosing your languages | ||||
|       # with: | ||||
|       #   languages: go, javascript, csharp, python, cpp, java, ruby | ||||
|  | @ -29,7 +29,7 @@ jobs: | |||
|     # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). | ||||
|     # If this step fails, then you should remove it and run the build manually (see below). | ||||
|     - name: Autobuild | ||||
|       uses: github/codeql-action/autobuild@v2 | ||||
|       uses: github/codeql-action/autobuild@v3 | ||||
| 
 | ||||
|     # ℹ️ Command-line programs to run using the OS shell. | ||||
|     # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||||
|  | @ -43,4 +43,4 @@ jobs: | |||
|     #     make release | ||||
| 
 | ||||
|     - name: Perform CodeQL Analysis | ||||
|       uses: github/codeql-action/analyze@v2 | ||||
|       uses: github/codeql-action/analyze@v3 | ||||
|  |  | |||
							
								
								
									
										31
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							|  | @ -10,6 +10,31 @@ on: | |||
|   workflow_dispatch: | ||||
| 
 | ||||
| jobs: | ||||
|   call-licensed: | ||||
|     name: Licensed | ||||
|     uses: actions/reusable-workflows/.github/workflows/licensed.yml@main | ||||
|   validate-cached-dependency-records: | ||||
|     runs-on: ubuntu-latest | ||||
|     name: Check licenses | ||||
|     steps: | ||||
| 
 | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
| 
 | ||||
|       - name: Install dependencies | ||||
|         run: npm ci --ignore-scripts | ||||
| 
 | ||||
|       - name: Set up Ruby | ||||
|         uses: ruby/setup-ruby@v1 | ||||
|         with: | ||||
|           ruby-version: '3.1.7' | ||||
| 
 | ||||
|       - name: Install licensed tool | ||||
|         run: | | ||||
|           cd "$RUNNER_TEMP" | ||||
|           curl -Lfs -o licensed.tar.gz https://github.com/licensee/licensed/archive/refs/tags/v5.0.4.tar.gz | ||||
|           tar -xzf licensed.tar.gz | ||||
|           cd licensed-5.0.4 | ||||
|           bundle install | ||||
| 
 | ||||
|       - name: Check cached dependency records | ||||
|         run: | | ||||
|           cd ${{ github.workspace }} | ||||
|           BUNDLE_GEMFILE=$RUNNER_TEMP/licensed-5.0.4/Gemfile bundle exec $RUNNER_TEMP/licensed-5.0.4/exe/licensed status | ||||
|  | @ -2,7 +2,7 @@ name: 'Publish Immutable Action Version' | |||
| 
 | ||||
| on: | ||||
|   release: | ||||
|     types: [published] | ||||
|     types: [released] | ||||
| 
 | ||||
| jobs: | ||||
|   publish: | ||||
|  |  | |||
							
								
								
									
										12
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							|  | @ -20,9 +20,9 @@ jobs: | |||
|     runs-on: ${{ matrix.os }} | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v3 | ||||
|       uses: actions/checkout@v4 | ||||
|     - name: Setup Node.js 20.x | ||||
|       uses: actions/setup-node@v3 | ||||
|       uses: actions/setup-node@v4 | ||||
|       with: | ||||
|         node-version: 20.x | ||||
|         cache: npm | ||||
|  | @ -43,7 +43,7 @@ jobs: | |||
|     runs-on: ${{ matrix.os }} | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v3 | ||||
|       uses: actions/checkout@v4 | ||||
|     - name: Generate files in working directory | ||||
|       shell: bash | ||||
|       run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache | ||||
|  | @ -66,7 +66,7 @@ jobs: | |||
|     runs-on: ${{ matrix.os }} | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v3 | ||||
|       uses: actions/checkout@v4 | ||||
|     - name: Restore cache | ||||
|       uses: ./ | ||||
|       with: | ||||
|  | @ -96,7 +96,7 @@ jobs: | |||
|       https_proxy: http://squid-proxy:3128 | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v3 | ||||
|       uses: actions/checkout@v4 | ||||
|     - name: Generate files | ||||
|       run: __tests__/create-cache-files.sh proxy test-cache | ||||
|     - name: Save cache | ||||
|  | @ -119,7 +119,7 @@ jobs: | |||
|       https_proxy: http://squid-proxy:3128 | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: actions/checkout@v3 | ||||
|       uses: actions/checkout@v4 | ||||
|     - name: Restore cache | ||||
|       uses: ./ | ||||
|       with: | ||||
|  |  | |||
|  | @ -1,6 +1,14 @@ | |||
| sources: | ||||
|   npm: true | ||||
| 
 | ||||
| # Force UTF-8 encoding | ||||
| encoding: 'utf-8' | ||||
| 
 | ||||
| # Ignore problematic packages with encoding issues | ||||
| ignored: | ||||
|   npm: | ||||
|     - form-data | ||||
| 
 | ||||
| allowed: | ||||
|   - apache-2.0 | ||||
|   - bsd-2-clause | ||||
|  | @ -14,3 +22,9 @@ allowed: | |||
| reviewed: | ||||
|   npm: | ||||
|   - sax | ||||
|   - "@protobuf-ts/plugin-framework" # Apache-2.0 | ||||
|   - "@protobuf-ts/runtime" # Apache-2.0 | ||||
|   - fs.realpath # ISC | ||||
|   - glob # ISC | ||||
|   - prettier # MIT | ||||
|   - lodash # MIT | ||||
							
								
								
									
										
											BIN
										
									
								
								.licenses/NOTICE
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/NOTICE
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@actions/io.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@actions/io.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@protobuf-ts/runtime-rpc.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@protobuf-ts/runtime-rpc.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@protobuf-ts/runtime.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@protobuf-ts/runtime.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/brace-expansion.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/brace-expansion.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/dunder-proto.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/dunder-proto.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/es-define-property.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/es-define-property.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/es-errors.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/es-errors.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/es-object-atoms.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/es-object-atoms.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/es-set-tostringtag.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/es-set-tostringtag.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/form-data-2.5.1.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/form-data-2.5.1.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/form-data-3.0.1.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/form-data-3.0.1.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/form-data-4.0.0.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/form-data-4.0.0.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/function-bind.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/function-bind.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/get-intrinsic.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/get-intrinsic.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/get-proto.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/get-proto.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/gopd.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/gopd.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/has-symbols.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/has-symbols.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/has-tostringtag.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/has-tostringtag.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/hasown.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/hasown.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/math-intrinsics.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/math-intrinsics.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/mime-db.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/mime-db.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/mime-types.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/mime-types.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/safe-buffer.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/safe-buffer.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										41
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								README.md
									
									
									
									
									
								
							|  | @ -3,6 +3,7 @@ | |||
| This action allows caching dependencies and build outputs to improve workflow execution time. | ||||
| 
 | ||||
| >Two other actions are available in addition to the primary `cache` action: | ||||
| > | ||||
| >* [Restore action](./restore/README.md) | ||||
| >* [Save action](./save/README.md) | ||||
| 
 | ||||
|  | @ -14,12 +15,33 @@ See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/ac | |||
| 
 | ||||
| ## What's New | ||||
| 
 | ||||
| ### ⚠️ Important changes | ||||
| 
 | ||||
| The cache backend service has been rewritten from the ground up for improved performance and reliability. [actions/cache](https://github.com/actions/cache) now integrates with the new cache service (v2) APIs. | ||||
| 
 | ||||
| The new service will gradually roll out as of **February 1st, 2025**. The legacy service will also be sunset on the same date. Changes in these releases are **fully backward compatible**. | ||||
| 
 | ||||
| **We are deprecating some versions of this action**. We recommend upgrading to version `v4` or `v3` as soon as possible before **February 1st, 2025.** (Upgrade instructions below). | ||||
| 
 | ||||
| If you are using pinned SHAs, please use the SHAs of versions `v4.2.0` or `v3.4.0`. | ||||
| 
 | ||||
| If you do not upgrade, all workflow runs using any of the deprecated [actions/cache](https://github.com/actions/cache) will fail. | ||||
| 
 | ||||
| Upgrading to the recommended versions will not break your workflows. | ||||
| 
 | ||||
| > **Additionally, if you are managing your own GitHub runners, you must update your runner version to `2.231.0` or newer to ensure compatibility with the new cache service.**   | ||||
| > Failure to update both the action version and your runner version may result in workflow failures after the migration date. | ||||
| 
 | ||||
| Read more about the change & access the migration guide: [reference to the announcement](https://github.com/actions/cache/discussions/1510). | ||||
| 
 | ||||
| ### v4 | ||||
| 
 | ||||
| * Integrated with the new cache service (v2) APIs. | ||||
| * Updated to node 20 | ||||
| 
 | ||||
| ### v3 | ||||
| 
 | ||||
| * Integrated with the new cache service (v2) APIs. | ||||
| * Added support for caching in GHES 3.5+. | ||||
| * Fixed download issue for files > 2GB during restore. | ||||
| * Updated the minimum runner version support from node 12 -> node 16. | ||||
|  | @ -157,6 +179,7 @@ Every programming language and framework has its own way of caching. | |||
| 
 | ||||
| See [Examples](examples.md) for a list of `actions/cache` implementations for use with: | ||||
| 
 | ||||
| * [Bun](./examples.md#bun) | ||||
| * [C# - NuGet](./examples.md#c---nuget) | ||||
| * [Clojure - Lein Deps](./examples.md#clojure---lein-deps) | ||||
| * [D - DUB](./examples.md#d---dub) | ||||
|  | @ -315,9 +338,23 @@ There are a number of community practices/workarounds to fulfill specific requir | |||
| 
 | ||||
| Please note that Windows environment variables (like `%LocalAppData%`) will NOT be expanded by this action. Instead, prefer using `~` in your paths which will expand to the HOME directory. For example, instead of `%LocalAppData%`, use `~\AppData\Local`. For a list of supported default environment variables, see the [Learn GitHub Actions: Variables](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) page. | ||||
| 
 | ||||
| ## Contributing | ||||
| ## Note | ||||
| 
 | ||||
| We would love for you to contribute to `actions/cache`. Pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information. | ||||
| Thank you for your interest in this GitHub repo, however, right now we are not taking contributions.  | ||||
| 
 | ||||
| We continue to focus our resources on strategic areas that help our customers be successful while making developers' lives easier. While GitHub Actions remains a key part of this vision, we are allocating resources towards other areas of Actions and are not taking contributions to this repository at this time. The GitHub public roadmap is the best place to follow along for any updates on features we’re working on and what stage they’re in. | ||||
| 
 | ||||
| We are taking the following steps to better direct requests related to GitHub Actions, including: | ||||
| 
 | ||||
| 1. We will be directing questions and support requests to our [Community Discussions area](https://github.com/orgs/community/discussions/categories/actions) | ||||
| 
 | ||||
| 2. High Priority bugs can be reported through Community Discussions or you can report these to our support team https://support.github.com/contact/bug-report. | ||||
| 
 | ||||
| 3. Security Issues should be handled as per our [security.md](SECURITY.md). | ||||
| 
 | ||||
| We will still provide security updates for this project and fix major breaking changes during this time. | ||||
| 
 | ||||
| You are welcome to still raise bugs in this repo. | ||||
| 
 | ||||
| ## License | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										45
									
								
								RELEASES.md
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								RELEASES.md
									
									
									
									
									
								
							|  | @ -1,9 +1,50 @@ | |||
| # Releases | ||||
| 
 | ||||
| ### 4.3.0 | ||||
| 
 | ||||
| - Bump `@actions/cache` to [v4.1.0](https://github.com/actions/toolkit/pull/2132) | ||||
| 
 | ||||
| ### 4.2.4 | ||||
| 
 | ||||
| - Bump `@actions/cache` to v4.0.5 | ||||
| 
 | ||||
| ### 4.2.3 | ||||
| 
 | ||||
| - Bump `@actions/cache` to v4.0.3 (obfuscates SAS token in debug logs for cache entries) | ||||
| 
 | ||||
| ### 4.2.2 | ||||
| 
 | ||||
| - Bump `@actions/cache` to v4.0.2 | ||||
| 
 | ||||
| ### 4.2.1 | ||||
| 
 | ||||
| - Bump `@actions/cache` to v4.0.1 | ||||
| 
 | ||||
| ### 4.2.0 | ||||
| 
 | ||||
| TLDR; The cache backend service has been rewritten from the ground up for improved performance and reliability. [actions/cache](https://github.com/actions/cache) now integrates with the new cache service (v2) APIs. | ||||
| 
 | ||||
| The new service will gradually roll out as of **February 1st, 2025**. The legacy service will also be sunset on the same date. Changes in these release are **fully backward compatible**. | ||||
| 
 | ||||
| **We are deprecating some versions of this action**. We recommend upgrading to version `v4` or `v3` as soon as possible before **February 1st, 2025.** (Upgrade instructions below). | ||||
| 
 | ||||
| If you are using pinned SHAs, please use the SHAs of versions `v4.2.0` or `v3.4.0` | ||||
| 
 | ||||
| If you do not upgrade, all workflow runs using any of the deprecated [actions/cache](https://github.com/actions/cache) will fail. | ||||
| 
 | ||||
| Upgrading to the recommended versions will not break your workflows. | ||||
| 
 | ||||
| ### 4.1.2 | ||||
| 
 | ||||
| - Add GitHub Enterprise Cloud instances hostname filters to inform API endpoint choices - [#1474](https://github.com/actions/cache/pull/1474) | ||||
| - Security fix: Bump braces from 3.0.2 to 3.0.3 - [#1475](https://github.com/actions/cache/pull/1475) | ||||
| 
 | ||||
| ### 4.1.1 | ||||
| 
 | ||||
| - Restore original behavior of `cache-hit` output - [#1467](https://github.com/actions/cache/pull/1467) | ||||
| 
 | ||||
| ### 4.1.0 | ||||
| 
 | ||||
| - Ensure `cache-hit` output is set when a cache is missed - [#1404](https://github.com/actions/cache/pull/1404) | ||||
| - Deprecate `save-always` input - [#1452](https://github.com/actions/cache/pull/1452) | ||||
| 
 | ||||
|  | @ -19,6 +60,10 @@ | |||
| 
 | ||||
| - Updated minimum runner version support from node 12 -> node 20 | ||||
| 
 | ||||
| ### 3.4.0 | ||||
| 
 | ||||
| - Integrated with the new cache service (v2) APIs | ||||
| 
 | ||||
| ### 3.3.3 | ||||
| 
 | ||||
| - Updates @actions/cache to v3.2.3 to fix accidental mutated path arguments to `getCacheVersion` [actions/toolkit#1378](https://github.com/actions/toolkit/pull/1378) | ||||
|  |  | |||
|  | @ -8,17 +8,26 @@ import * as testUtils from "../src/utils/testUtils"; | |||
| jest.mock("@actions/core"); | ||||
| jest.mock("@actions/cache"); | ||||
| 
 | ||||
| let pristineEnv: NodeJS.ProcessEnv; | ||||
| 
 | ||||
| beforeAll(() => { | ||||
|     pristineEnv = process.env; | ||||
|     jest.spyOn(core, "getInput").mockImplementation((name, options) => { | ||||
|         return jest.requireActual("@actions/core").getInput(name, options); | ||||
|     }); | ||||
| }); | ||||
| 
 | ||||
| afterEach(() => { | ||||
| beforeEach(() => { | ||||
|     jest.resetModules(); | ||||
|     process.env = pristineEnv; | ||||
|     delete process.env[Events.Key]; | ||||
|     delete process.env[RefKey]; | ||||
| }); | ||||
| 
 | ||||
| afterAll(() => { | ||||
|     process.env = pristineEnv; | ||||
| }); | ||||
| 
 | ||||
| test("isGhes returns true if server url is not github.com", () => { | ||||
|     try { | ||||
|         process.env["GITHUB_SERVER_URL"] = "http://example.com"; | ||||
|  | @ -231,3 +240,28 @@ test("isCacheFeatureAvailable for ac disabled on dotcom", () => { | |||
|         delete process.env["GITHUB_SERVER_URL"]; | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
| test("isGhes returns false when the GITHUB_SERVER_URL environment variable is not defined", async () => { | ||||
|     delete process.env["GITHUB_SERVER_URL"]; | ||||
|     expect(actionUtils.isGhes()).toBeFalsy(); | ||||
| }); | ||||
| 
 | ||||
| test("isGhes returns false when the GITHUB_SERVER_URL environment variable is set to github.com", async () => { | ||||
|     process.env["GITHUB_SERVER_URL"] = "https://github.com"; | ||||
|     expect(actionUtils.isGhes()).toBeFalsy(); | ||||
| }); | ||||
| 
 | ||||
| test("isGhes returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL", async () => { | ||||
|     process.env["GITHUB_SERVER_URL"] = "https://contoso.ghe.com"; | ||||
|     expect(actionUtils.isGhes()).toBeFalsy(); | ||||
| }); | ||||
| 
 | ||||
| test("isGhes returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix", async () => { | ||||
|     process.env["GITHUB_SERVER_URL"] = "https://mock-github.localhost"; | ||||
|     expect(actionUtils.isGhes()).toBeFalsy(); | ||||
| }); | ||||
| 
 | ||||
| test("isGhes returns true when the GITHUB_SERVER_URL environment variable is set to some other URL", async () => { | ||||
|     process.env["GITHUB_SERVER_URL"] = "https://src.onpremise.fabrikam.com"; | ||||
|     expect(actionUtils.isGhes()).toBeTruthy(); | ||||
| }); | ||||
|  |  | |||
|  | @ -102,7 +102,7 @@ The [GitHub Context](https://docs.github.com/en/actions/learn-github-actions/con | |||
| 
 | ||||
| While setting paths for caching dependencies it is important to give correct path depending on the hosted runner you are using or whether the action is running in a container job. Assigning different `path` for save and restore will result in cache miss. | ||||
| 
 | ||||
| Below are GiHub hosted runner specific paths one should take care of when writing a workflow which saves/restores caches across OS. | ||||
| Below are GitHub hosted runner specific paths one should take care of when writing a workflow which saves/restores caches across OS. | ||||
| 
 | ||||
| #### Ubuntu Paths | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										10327
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10327
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										10327
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10327
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										10327
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10327
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										10327
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10327
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										21
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								examples.md
									
									
									
									
									
								
							|  | @ -1,5 +1,6 @@ | |||
| # Examples | ||||
| 
 | ||||
| - [Bun](#bun) | ||||
| - [C# - NuGet](#c---nuget) | ||||
| - [Clojure - Lein Deps](#clojure---lein-deps) | ||||
| - [D - DUB](#d---dub) | ||||
|  | @ -41,6 +42,26 @@ | |||
| - [Swift - Mint](#swift---mint) | ||||
| - [* - Bazel](#---bazel) | ||||
| 
 | ||||
| ## Bun | ||||
| 
 | ||||
| ```yaml | ||||
| - uses: actions/cache@v4 | ||||
|   with: | ||||
|     path: | | ||||
|       ~/.bun/install/cache | ||||
|     key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||||
| ``` | ||||
| 
 | ||||
| ### Windows | ||||
| 
 | ||||
| ```yaml | ||||
| - uses: actions/cache@v4 | ||||
|   with: | ||||
|     path: | | ||||
|       ~\.bun | ||||
|     key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||||
| ``` | ||||
| 
 | ||||
| ## C# - NuGet | ||||
| 
 | ||||
| Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies): | ||||
|  |  | |||
							
								
								
									
										1097
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1097
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										10
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								package.json
									
									
									
									
									
								
							|  | @ -1,6 +1,6 @@ | |||
| { | ||||
|   "name": "cache", | ||||
|   "version": "4.1.1", | ||||
|   "version": "4.3.0", | ||||
|   "private": true, | ||||
|   "description": "Cache dependencies and build outputs", | ||||
|   "main": "dist/restore/index.js", | ||||
|  | @ -23,10 +23,10 @@ | |||
|   "author": "GitHub", | ||||
|   "license": "MIT", | ||||
|   "dependencies": { | ||||
|     "@actions/cache": "^3.2.3", | ||||
|     "@actions/core": "^1.10.0", | ||||
|     "@actions/cache": "^4.1.0", | ||||
|     "@actions/core": "^1.11.1", | ||||
|     "@actions/exec": "^1.1.1", | ||||
|     "@actions/io": "^1.1.2" | ||||
|     "@actions/io": "^1.1.3" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@types/jest": "^27.5.2", | ||||
|  | @ -34,7 +34,7 @@ | |||
|     "@types/node": "^16.18.3", | ||||
|     "@typescript-eslint/eslint-plugin": "^5.45.0", | ||||
|     "@typescript-eslint/parser": "^5.45.0", | ||||
|     "@vercel/ncc": "^0.38.1", | ||||
|     "@vercel/ncc": "^0.38.3", | ||||
|     "eslint": "^8.28.0", | ||||
|     "eslint-config-prettier": "^8.5.0", | ||||
|     "eslint-plugin-import": "^2.26.0", | ||||
|  |  | |||
|  | @ -79,8 +79,10 @@ To avoid saving a cache that already exists, the `cache-hit` output from a resto | |||
| The `cache-primary-key` output from the restore step should also be used to ensure | ||||
| the cache key does not change during the build if it's calculated based on file contents. | ||||
| 
 | ||||
| Here's an example where we imagine we're calculating a lot of prime numbers and want to cache them: | ||||
| 
 | ||||
| ```yaml | ||||
| name: Always Caching Primes | ||||
| name: Always Caching Prime Numbers | ||||
| 
 | ||||
| on: push | ||||
| 
 | ||||
|  | @ -91,23 +93,23 @@ jobs: | |||
|     steps: | ||||
|     - uses: actions/checkout@v4 | ||||
| 
 | ||||
|     - name: Restore cached Primes | ||||
|       id: cache-primes-restore | ||||
|     - name: Restore cached Prime Numbers | ||||
|       id: cache-prime-numbers-restore | ||||
|       uses: actions/cache/restore@v4 | ||||
|       with: | ||||
|         key: ${{ runner.os }}-primes | ||||
|         key: ${{ runner.os }}-prime-numbers | ||||
|         path: | | ||||
|           path/to/dependencies | ||||
|           some/other/dependencies | ||||
| 
 | ||||
|     # Intermediate workflow steps | ||||
| 
 | ||||
|     - name: Always Save Primes | ||||
|       id: cache-primes-save | ||||
|       if: always() && steps.cache-primes-restore.outputs.cache-hit != 'true' | ||||
|     - name: Always Save Prime Numbers | ||||
|       id: cache-prime-numbers-save | ||||
|       if: always() && steps.cache-prime-numbers-restore.outputs.cache-hit != 'true' | ||||
|       uses: actions/cache/save@v4 | ||||
|       with: | ||||
|         key: ${{ steps.cache-primes-restore.outputs.cache-primary-key }} | ||||
|         key: ${{ steps.cache-prime-numbers-restore.outputs.cache-primary-key }} | ||||
|         path: | | ||||
|           path/to/dependencies | ||||
|           some/other/dependencies | ||||
|  |  | |||
|  | @ -7,7 +7,13 @@ export function isGhes(): boolean { | |||
|     const ghUrl = new URL( | ||||
|         process.env["GITHUB_SERVER_URL"] || "https://github.com" | ||||
|     ); | ||||
|     return ghUrl.hostname.toUpperCase() !== "GITHUB.COM"; | ||||
| 
 | ||||
|     const hostname = ghUrl.hostname.trimEnd().toUpperCase(); | ||||
|     const isGitHubHost = hostname === "GITHUB.COM"; | ||||
|     const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM"); | ||||
|     const isLocalHost = hostname.endsWith(".LOCALHOST"); | ||||
| 
 | ||||
|     return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost; | ||||
| } | ||||
| 
 | ||||
| export function isExactKeyMatch(key: string, cacheKey?: string): boolean { | ||||
|  |  | |||
|  | @ -37,9 +37,8 @@ From `v3.2.3` cache is cross-os compatible when `enableCrossOsArchive` input is | |||
| 
 | ||||
| ## Force deletion of caches overriding default cache eviction policy | ||||
| 
 | ||||
| Caches have [branch scope restriction](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache) in place. This means that if caches for a specific branch are using a lot of storage quota, it may result into more frequently used caches from `default` branch getting thrashed. For example, if there are many pull requests happening on a repo and are creating caches, these cannot be used in default branch scope but will still occupy a lot of space till they get cleaned up by [eviction policy](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy). But sometime we want to clean them up on a faster cadence so as to ensure default branch is not thrashing. In order to achieve this, [gh-actions-cache cli](https://github.com/actions/gh-actions-cache/) can be used to delete caches for specific branches. | ||||
| Caches have [branch scope restriction](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache) in place. This means that if caches for a specific branch are using a lot of storage quota, it may result into more frequently used caches from `default` branch getting thrashed. For example, if there are many pull requests happening on a repo and are creating caches, these cannot be used in default branch scope but will still occupy a lot of space till they get cleaned up by [eviction policy](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy). But sometime we want to clean them up on a faster cadence so as to ensure default branch is not thrashing. | ||||
| 
 | ||||
| This workflow uses `gh-actions-cache` to delete all the caches created by a branch. | ||||
| <details> | ||||
|   <summary>Example</summary> | ||||
| 
 | ||||
|  | @ -60,29 +59,23 @@ jobs: | |||
|       actions: write | ||||
|       contents: read | ||||
|     steps: | ||||
|       - name: Check out code | ||||
|         uses: actions/checkout@v4 | ||||
| 
 | ||||
|       - name: Cleanup | ||||
|         run: | | ||||
|           gh extension install actions/gh-actions-cache | ||||
|            | ||||
|           REPO=${{ github.repository }} | ||||
|           BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge | ||||
| 
 | ||||
|           echo "Fetching list of cache key" | ||||
|           cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | ||||
|           cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id') | ||||
| 
 | ||||
|           ## Setting this to not fail the workflow while deleting cache keys. | ||||
|           set +e | ||||
|           echo "Deleting caches..." | ||||
|           for cacheKey in $cacheKeysForPR | ||||
|           do | ||||
|               gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | ||||
|               gh cache delete $cacheKey | ||||
|           done | ||||
|           echo "Done" | ||||
|         env: | ||||
|           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|           GH_REPO: ${{ github.repository }} | ||||
|           BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge | ||||
| ``` | ||||
| 
 | ||||
| </details> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user