mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 07:16:24 +07:00 
			
		
		
		
	Compare commits
	
		
			26 Commits
		
	
	
		
			v3.0.0
			...
			testGheswi
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7852e58f8c | |||
| 7d4f40b464 | |||
| c31528629d | |||
| 0137340fba | |||
| 90e5189d64 | |||
| 5c8d224b05 | |||
| d21804b55f | |||
| 587260d98f | |||
| f4b8916a4f | |||
| 6bf3948635 | |||
| 31da19523d | |||
| e093ab00fc | |||
| c5862e209e | |||
| 9fae644795 | |||
| 7e4d931f67 | |||
| bc53ec57f3 | |||
| 234b8019b9 | |||
| 770facace5 | |||
| 0be029b716 | |||
| 85665c5247 | |||
| c29e204c9f | |||
| 998cb51251 | |||
| 824f444748 | |||
| 1a306b5b35 | |||
| 2d8d0d1c9b | |||
| 7799d864d9 | 
							
								
								
									
										2
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							| @ -34,7 +34,7 @@ jobs: | |||||||
|       run: | |       run: | | ||||||
|         echo "::set-output name=dir::$(npm config get cache)" |         echo "::set-output name=dir::$(npm config get cache)" | ||||||
|     - name: Restore npm cache |     - name: Restore npm cache | ||||||
|       uses: actions/cache@v2 |       uses: actions/cache@v3 | ||||||
|       with: |       with: | ||||||
|         path: ${{ steps.npm-cache.outputs.dir }} |         path: ${{ steps.npm-cache.outputs.dir }} | ||||||
|         key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |         key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: "@actions/cache" | name: "@actions/cache" | ||||||
| version: 1.0.10 | version: 2.0.0 | ||||||
| type: npm | type: npm | ||||||
| summary:  | summary:  | ||||||
| homepage:  | homepage:  | ||||||
|  | |||||||
							
								
								
									
										22
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								README.md
									
									
									
									
									
								
							| @ -9,12 +9,18 @@ This action allows caching dependencies and build outputs to improve workflow ex | |||||||
| See ["Caching dependencies to speed up workflows"](https://help.github.com/github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows). | See ["Caching dependencies to speed up workflows"](https://help.github.com/github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows). | ||||||
|  |  | ||||||
| ## What's New | ## What's New | ||||||
|  | ### v3 | ||||||
|  | * Added support for caching from GHES 3.5. | ||||||
|  | * Fixed download issue for files > 2GB during restore. | ||||||
|  | * Updated the minimum runner version support from node 12 -> node 16. | ||||||
|  |  | ||||||
|  | ### v2 | ||||||
|  | * Increased the cache size limit to 10 GB. | ||||||
| * Added support for multiple paths, [glob patterns](https://github.com/actions/toolkit/tree/main/packages/glob), and single file caches. | * Added support for multiple paths, [glob patterns](https://github.com/actions/toolkit/tree/main/packages/glob), and single file caches. | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - name: Cache multiple paths | - name: Cache multiple paths | ||||||
|   uses: actions/cache@v2 |   uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/cache |       ~/cache | ||||||
| @ -69,7 +75,7 @@ jobs: | |||||||
|  |  | ||||||
|     - name: Cache Primes |     - name: Cache Primes | ||||||
|       id: cache-primes |       id: cache-primes | ||||||
|       uses: actions/cache@v2 |       uses: actions/cache@v3 | ||||||
|       with: |       with: | ||||||
|         path: prime-numbers |         path: prime-numbers | ||||||
|         key: ${{ runner.os }}-primes |         key: ${{ runner.os }}-primes | ||||||
| @ -119,7 +125,7 @@ A cache key can include any of the contexts, functions, literals, and operators | |||||||
| For example, using the [`hashFiles`](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#hashfiles) function allows you to create a new cache when dependencies change. | For example, using the [`hashFiles`](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#hashfiles) function allows you to create a new cache when dependencies change. | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
|   - uses: actions/cache@v2 |   - uses: actions/cache@v3 | ||||||
|     with: |     with: | ||||||
|       path: | |       path: | | ||||||
|         path/to/dependencies |         path/to/dependencies | ||||||
| @ -137,7 +143,7 @@ Additionally, you can use arbitrary command output in a cache key, such as a dat | |||||||
|       echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")" |       echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")" | ||||||
|     shell: bash |     shell: bash | ||||||
|  |  | ||||||
|   - uses: actions/cache@v2 |   - uses: actions/cache@v3 | ||||||
|     with: |     with: | ||||||
|       path: path/to/dependencies |       path: path/to/dependencies | ||||||
|       key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }} |       key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }} | ||||||
| @ -158,7 +164,7 @@ Example: | |||||||
| steps: | steps: | ||||||
|   - uses: actions/checkout@v2 |   - uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|   - uses: actions/cache@v2 |   - uses: actions/cache@v3 | ||||||
|     id: cache |     id: cache | ||||||
|     with: |     with: | ||||||
|       path: path/to/dependencies |       path: path/to/dependencies | ||||||
| @ -171,12 +177,6 @@ steps: | |||||||
|  |  | ||||||
| > Note: The `id` defined in `actions/cache` must match the `id` in the `if` statement (i.e. `steps.[ID].outputs.cache-hit`) | > Note: The `id` defined in `actions/cache` must match the `id` in the `if` statement (i.e. `steps.[ID].outputs.cache-hit`) | ||||||
|  |  | ||||||
| ## Known limitation |  | ||||||
|  |  | ||||||
| - `action/cache` is currently not supported on GitHub Enterprise Server. <https://github.com/github/roadmap/issues/273> is tracking this. |  | ||||||
|  |  | ||||||
| Since GitHub Enterprise Server uses self-hosted runners, dependencies are typically cached on the runner by whatever dependency management tool is being used (npm, maven, etc.).  This eliminates the need for explicit caching in some scenarios. |  | ||||||
|  |  | ||||||
| ## Contributing | ## Contributing | ||||||
| We would love for you to contribute to `actions/cache`, pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information. | We would love for you to contribute to `actions/cache`, pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information. | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								RELEASES.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								RELEASES.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | # Releases | ||||||
|  |  | ||||||
|  | ### 3.0.0 | ||||||
|  | - Updated minimum runner version support from node 12 -> node 16 | ||||||
|  |  | ||||||
|  | ### 3.0.1 | ||||||
|  | - Added support for caching from GHES 3.5. | ||||||
|  | - Fixed download issue for files > 2GB during restore. | ||||||
| @ -1,3 +1,4 @@ | |||||||
|  | import * as cache from "@actions/cache"; | ||||||
| import * as core from "@actions/core"; | import * as core from "@actions/core"; | ||||||
|  |  | ||||||
| import { Events, Outputs, RefKey, State } from "../src/constants"; | import { Events, Outputs, RefKey, State } from "../src/constants"; | ||||||
| @ -5,6 +6,7 @@ import * as actionUtils from "../src/utils/actionUtils"; | |||||||
| import * as testUtils from "../src/utils/testUtils"; | import * as testUtils from "../src/utils/testUtils"; | ||||||
|  |  | ||||||
| jest.mock("@actions/core"); | jest.mock("@actions/core"); | ||||||
|  | jest.mock("@actions/cache"); | ||||||
|  |  | ||||||
| beforeAll(() => { | beforeAll(() => { | ||||||
|     jest.spyOn(core, "getInput").mockImplementation((name, options) => { |     jest.spyOn(core, "getInput").mockImplementation((name, options) => { | ||||||
| @ -232,3 +234,41 @@ test("getInputAsInt throws if required and value missing", () => { | |||||||
|         actionUtils.getInputAsInt("undefined", { required: true }) |         actionUtils.getInputAsInt("undefined", { required: true }) | ||||||
|     ).toThrowError(); |     ).toThrowError(); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | test("isCacheFeatureAvailable for ac enabled", () => { | ||||||
|  |     jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => true); | ||||||
|  |  | ||||||
|  |     expect(actionUtils.isCacheFeatureAvailable()).toBe(true); | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | test("isCacheFeatureAvailable for ac disabled on GHES", () => { | ||||||
|  |     jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => false); | ||||||
|  |  | ||||||
|  |     const message = | ||||||
|  |         "Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not."; | ||||||
|  |     const infoMock = jest.spyOn(core, "info"); | ||||||
|  |  | ||||||
|  |     try { | ||||||
|  |         process.env["GITHUB_SERVER_URL"] = "http://example.com"; | ||||||
|  |         expect(actionUtils.isCacheFeatureAvailable()).toBe(false); | ||||||
|  |         expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`); | ||||||
|  |     } finally { | ||||||
|  |         delete process.env["GITHUB_SERVER_URL"]; | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | test("isCacheFeatureAvailable for ac disabled on dotcom", () => { | ||||||
|  |     jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => false); | ||||||
|  |  | ||||||
|  |     const message = | ||||||
|  |         "An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions."; | ||||||
|  |     const infoMock = jest.spyOn(core, "info"); | ||||||
|  |  | ||||||
|  |     try { | ||||||
|  |         process.env["GITHUB_SERVER_URL"] = "http://github.com"; | ||||||
|  |         expect(actionUtils.isCacheFeatureAvailable()).toBe(false); | ||||||
|  |         expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`); | ||||||
|  |     } finally { | ||||||
|  |         delete process.env["GITHUB_SERVER_URL"]; | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  | |||||||
| @ -34,6 +34,9 @@ beforeEach(() => { | |||||||
|     process.env[RefKey] = "refs/heads/feature-branch"; |     process.env[RefKey] = "refs/heads/feature-branch"; | ||||||
|  |  | ||||||
|     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); |     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); | ||||||
|  |     jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation( | ||||||
|  |         () => true | ||||||
|  |     ); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| afterEach(() => { | afterEach(() => { | ||||||
| @ -55,10 +58,12 @@ test("restore with invalid event outputs warning", async () => { | |||||||
|     expect(failedMock).toHaveBeenCalledTimes(0); |     expect(failedMock).toHaveBeenCalledTimes(0); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| test("restore on GHES should no-op", async () => { | test("restore without AC available should no-op", async () => { | ||||||
|     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); |     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); | ||||||
|  |     jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation( | ||||||
|  |         () => false | ||||||
|  |     ); | ||||||
|  |  | ||||||
|     const logWarningMock = jest.spyOn(actionUtils, "logWarning"); |  | ||||||
|     const restoreCacheMock = jest.spyOn(cache, "restoreCache"); |     const restoreCacheMock = jest.spyOn(cache, "restoreCache"); | ||||||
|     const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); |     const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); | ||||||
|  |  | ||||||
| @ -67,9 +72,54 @@ test("restore on GHES should no-op", async () => { | |||||||
|     expect(restoreCacheMock).toHaveBeenCalledTimes(0); |     expect(restoreCacheMock).toHaveBeenCalledTimes(0); | ||||||
|     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); |     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); | ||||||
|     expect(setCacheHitOutputMock).toHaveBeenCalledWith(false); |     expect(setCacheHitOutputMock).toHaveBeenCalledWith(false); | ||||||
|     expect(logWarningMock).toHaveBeenCalledWith( | }); | ||||||
|         "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" |  | ||||||
|  | test("restore on GHES without AC available should no-op", async () => { | ||||||
|  |     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); | ||||||
|  |     jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation( | ||||||
|  |         () => false | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
|  |     const restoreCacheMock = jest.spyOn(cache, "restoreCache"); | ||||||
|  |     const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); | ||||||
|  |  | ||||||
|  |     await run(); | ||||||
|  |  | ||||||
|  |     expect(restoreCacheMock).toHaveBeenCalledTimes(0); | ||||||
|  |     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); | ||||||
|  |     expect(setCacheHitOutputMock).toHaveBeenCalledWith(false); | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | test("restore on GHES with AC available ", async () => { | ||||||
|  |     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); | ||||||
|  |     const path = "node_modules"; | ||||||
|  |     const key = "node-test"; | ||||||
|  |     testUtils.setInputs({ | ||||||
|  |         path: path, | ||||||
|  |         key | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     const infoMock = jest.spyOn(core, "info"); | ||||||
|  |     const failedMock = jest.spyOn(core, "setFailed"); | ||||||
|  |     const stateMock = jest.spyOn(core, "saveState"); | ||||||
|  |     const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); | ||||||
|  |     const restoreCacheMock = jest | ||||||
|  |         .spyOn(cache, "restoreCache") | ||||||
|  |         .mockImplementationOnce(() => { | ||||||
|  |             return Promise.resolve(key); | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |     await run(); | ||||||
|  |  | ||||||
|  |     expect(restoreCacheMock).toHaveBeenCalledTimes(1); | ||||||
|  |     expect(restoreCacheMock).toHaveBeenCalledWith([path], key, []); | ||||||
|  |  | ||||||
|  |     expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); | ||||||
|  |     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); | ||||||
|  |     expect(setCacheHitOutputMock).toHaveBeenCalledWith(true); | ||||||
|  |  | ||||||
|  |     expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`); | ||||||
|  |     expect(failedMock).toHaveBeenCalledTimes(0); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| test("restore with no path should fail", async () => { | test("restore with no path should fail", async () => { | ||||||
|  | |||||||
| @ -54,6 +54,9 @@ beforeEach(() => { | |||||||
|     process.env[RefKey] = "refs/heads/feature-branch"; |     process.env[RefKey] = "refs/heads/feature-branch"; | ||||||
|  |  | ||||||
|     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); |     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); | ||||||
|  |     jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation( | ||||||
|  |         () => true | ||||||
|  |     ); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| afterEach(() => { | afterEach(() => { | ||||||
| @ -101,18 +104,67 @@ test("save with no primary key in state outputs warning", async () => { | |||||||
|     expect(failedMock).toHaveBeenCalledTimes(0); |     expect(failedMock).toHaveBeenCalledTimes(0); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| test("save on GHES should no-op", async () => { | test("save without AC available should no-op", async () => { | ||||||
|     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); |     jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation( | ||||||
|  |         () => false | ||||||
|  |     ); | ||||||
|  |  | ||||||
|     const logWarningMock = jest.spyOn(actionUtils, "logWarning"); |  | ||||||
|     const saveCacheMock = jest.spyOn(cache, "saveCache"); |     const saveCacheMock = jest.spyOn(cache, "saveCache"); | ||||||
|  |  | ||||||
|     await run(); |     await run(); | ||||||
|  |  | ||||||
|     expect(saveCacheMock).toHaveBeenCalledTimes(0); |     expect(saveCacheMock).toHaveBeenCalledTimes(0); | ||||||
|     expect(logWarningMock).toHaveBeenCalledWith( | }); | ||||||
|         "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" |  | ||||||
|  | test("save on ghes without AC available should no-op", async () => { | ||||||
|  |     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); | ||||||
|  |     jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation( | ||||||
|  |         () => false | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
|  |     const saveCacheMock = jest.spyOn(cache, "saveCache"); | ||||||
|  |  | ||||||
|  |     await run(); | ||||||
|  |  | ||||||
|  |     expect(saveCacheMock).toHaveBeenCalledTimes(0); | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | test("save on GHES with AC available", async () => { | ||||||
|  |     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); | ||||||
|  |     const failedMock = jest.spyOn(core, "setFailed"); | ||||||
|  |  | ||||||
|  |     const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; | ||||||
|  |     const savedCacheKey = "Linux-node-"; | ||||||
|  |  | ||||||
|  |     jest.spyOn(core, "getState") | ||||||
|  |         // Cache Entry State | ||||||
|  |         .mockImplementationOnce(() => { | ||||||
|  |             return savedCacheKey; | ||||||
|  |         }) | ||||||
|  |         // Cache Key State | ||||||
|  |         .mockImplementationOnce(() => { | ||||||
|  |             return primaryKey; | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |     const inputPath = "node_modules"; | ||||||
|  |     testUtils.setInput(Inputs.Path, inputPath); | ||||||
|  |     testUtils.setInput(Inputs.UploadChunkSize, "4000000"); | ||||||
|  |  | ||||||
|  |     const cacheId = 4; | ||||||
|  |     const saveCacheMock = jest | ||||||
|  |         .spyOn(cache, "saveCache") | ||||||
|  |         .mockImplementationOnce(() => { | ||||||
|  |             return Promise.resolve(cacheId); | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |     await run(); | ||||||
|  |  | ||||||
|  |     expect(saveCacheMock).toHaveBeenCalledTimes(1); | ||||||
|  |     expect(saveCacheMock).toHaveBeenCalledWith([inputPath], primaryKey, { | ||||||
|  |         uploadChunkSize: 4000000 | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     expect(failedMock).toHaveBeenCalledTimes(0); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| test("save with exact match returns early", async () => { | test("save with exact match returns early", async () => { | ||||||
|  | |||||||
							
								
								
									
										36
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							| @ -3221,10 +3221,7 @@ const options_1 = __webpack_require__(538); | |||||||
| const requestUtils_1 = __webpack_require__(899); | const requestUtils_1 = __webpack_require__(899); | ||||||
| const versionSalt = '1.0'; | const versionSalt = '1.0'; | ||||||
| function getCacheApiUrl(resource) { | function getCacheApiUrl(resource) { | ||||||
|     // Ideally we just use ACTIONS_CACHE_URL
 |     const baseUrl = process.env['ACTIONS_CACHE_URL'] || ''; | ||||||
|     const baseUrl = (process.env['ACTIONS_CACHE_URL'] || |  | ||||||
|         process.env['ACTIONS_RUNTIME_URL'] || |  | ||||||
|         '').replace('pipelines', 'artifactcache'); |  | ||||||
|     if (!baseUrl) { |     if (!baseUrl) { | ||||||
|         throw new Error('Cache Service Url not found, unable to restore cache.'); |         throw new Error('Cache Service Url not found, unable to restore cache.'); | ||||||
|     } |     } | ||||||
| @ -5519,7 +5516,8 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) { | |||||||
|             //
 |             //
 | ||||||
|             // If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
 |             // If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
 | ||||||
|             // on 64-bit systems), split the download into multiple segments
 |             // on 64-bit systems), split the download into multiple segments
 | ||||||
|             const maxSegmentSize = buffer.constants.MAX_LENGTH; |             // ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly.
 | ||||||
|  |             const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH); | ||||||
|             const downloadProgress = new DownloadProgress(contentLength); |             const downloadProgress = new DownloadProgress(contentLength); | ||||||
|             const fd = fs.openSync(archivePath, 'w'); |             const fd = fs.openSync(archivePath, 'w'); | ||||||
|             try { |             try { | ||||||
| @ -37459,7 +37457,8 @@ var __importStar = (this && this.__importStar) || function (mod) { | |||||||
|     return result; |     return result; | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", { value: true }); | Object.defineProperty(exports, "__esModule", { value: true }); | ||||||
| exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0; | exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0; | ||||||
|  | const cache = __importStar(__webpack_require__(692)); | ||||||
| const core = __importStar(__webpack_require__(470)); | const core = __importStar(__webpack_require__(470)); | ||||||
| const constants_1 = __webpack_require__(196); | const constants_1 = __webpack_require__(196); | ||||||
| function isGhes() { | function isGhes() { | ||||||
| @ -37524,6 +37523,19 @@ function getInputAsInt(name, options) { | |||||||
|     return value; |     return value; | ||||||
| } | } | ||||||
| exports.getInputAsInt = getInputAsInt; | exports.getInputAsInt = getInputAsInt; | ||||||
|  | function isCacheFeatureAvailable() { | ||||||
|  |     if (!cache.isFeatureAvailable()) { | ||||||
|  |         if (isGhes()) { | ||||||
|  |             logWarning("Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not."); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             logWarning("An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions."); | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | exports.isCacheFeatureAvailable = isCacheFeatureAvailable; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /***/ }), | /***/ }), | ||||||
| @ -46439,6 +46451,15 @@ function checkKey(key) { | |||||||
|         throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`); |         throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | /** | ||||||
|  |  * isFeatureAvailable to check the presence of Actions cache service | ||||||
|  |  * | ||||||
|  |  * @returns boolean return true if Actions cache service feature is available, otherwise false | ||||||
|  |  */ | ||||||
|  | function isFeatureAvailable() { | ||||||
|  |     return !!process.env['ACTIONS_CACHE_URL']; | ||||||
|  | } | ||||||
|  | exports.isFeatureAvailable = isFeatureAvailable; | ||||||
| /** | /** | ||||||
|  * Restores cache from keys |  * Restores cache from keys | ||||||
|  * |  * | ||||||
| @ -48100,8 +48121,7 @@ const utils = __importStar(__webpack_require__(443)); | |||||||
| function run() { | function run() { | ||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|         try { |         try { | ||||||
|             if (utils.isGhes()) { |             if (!utils.isCacheFeatureAvailable()) { | ||||||
|                 utils.logWarning("Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"); |  | ||||||
|                 utils.setCacheHitOutput(false); |                 utils.setCacheHitOutput(false); | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|  | |||||||
							
								
								
									
										36
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -3221,10 +3221,7 @@ const options_1 = __webpack_require__(538); | |||||||
| const requestUtils_1 = __webpack_require__(899); | const requestUtils_1 = __webpack_require__(899); | ||||||
| const versionSalt = '1.0'; | const versionSalt = '1.0'; | ||||||
| function getCacheApiUrl(resource) { | function getCacheApiUrl(resource) { | ||||||
|     // Ideally we just use ACTIONS_CACHE_URL
 |     const baseUrl = process.env['ACTIONS_CACHE_URL'] || ''; | ||||||
|     const baseUrl = (process.env['ACTIONS_CACHE_URL'] || |  | ||||||
|         process.env['ACTIONS_RUNTIME_URL'] || |  | ||||||
|         '').replace('pipelines', 'artifactcache'); |  | ||||||
|     if (!baseUrl) { |     if (!baseUrl) { | ||||||
|         throw new Error('Cache Service Url not found, unable to restore cache.'); |         throw new Error('Cache Service Url not found, unable to restore cache.'); | ||||||
|     } |     } | ||||||
| @ -5519,7 +5516,8 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) { | |||||||
|             //
 |             //
 | ||||||
|             // If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
 |             // If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
 | ||||||
|             // on 64-bit systems), split the download into multiple segments
 |             // on 64-bit systems), split the download into multiple segments
 | ||||||
|             const maxSegmentSize = buffer.constants.MAX_LENGTH; |             // ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly.
 | ||||||
|  |             const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH); | ||||||
|             const downloadProgress = new DownloadProgress(contentLength); |             const downloadProgress = new DownloadProgress(contentLength); | ||||||
|             const fd = fs.openSync(archivePath, 'w'); |             const fd = fs.openSync(archivePath, 'w'); | ||||||
|             try { |             try { | ||||||
| @ -37459,7 +37457,8 @@ var __importStar = (this && this.__importStar) || function (mod) { | |||||||
|     return result; |     return result; | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", { value: true }); | Object.defineProperty(exports, "__esModule", { value: true }); | ||||||
| exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0; | exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0; | ||||||
|  | const cache = __importStar(__webpack_require__(692)); | ||||||
| const core = __importStar(__webpack_require__(470)); | const core = __importStar(__webpack_require__(470)); | ||||||
| const constants_1 = __webpack_require__(196); | const constants_1 = __webpack_require__(196); | ||||||
| function isGhes() { | function isGhes() { | ||||||
| @ -37524,6 +37523,19 @@ function getInputAsInt(name, options) { | |||||||
|     return value; |     return value; | ||||||
| } | } | ||||||
| exports.getInputAsInt = getInputAsInt; | exports.getInputAsInt = getInputAsInt; | ||||||
|  | function isCacheFeatureAvailable() { | ||||||
|  |     if (!cache.isFeatureAvailable()) { | ||||||
|  |         if (isGhes()) { | ||||||
|  |             logWarning("Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not."); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             logWarning("An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions."); | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | exports.isCacheFeatureAvailable = isCacheFeatureAvailable; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /***/ }), | /***/ }), | ||||||
| @ -46388,8 +46400,7 @@ process.on("uncaughtException", e => utils.logWarning(e.message)); | |||||||
| function run() { | function run() { | ||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|         try { |         try { | ||||||
|             if (utils.isGhes()) { |             if (!utils.isCacheFeatureAvailable()) { | ||||||
|                 utils.logWarning("Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"); |  | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|             if (!utils.isValidEvent()) { |             if (!utils.isValidEvent()) { | ||||||
| @ -46533,6 +46544,15 @@ function checkKey(key) { | |||||||
|         throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`); |         throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | /** | ||||||
|  |  * isFeatureAvailable to check the presence of Actions cache service | ||||||
|  |  * | ||||||
|  |  * @returns boolean return true if Actions cache service feature is available, otherwise false | ||||||
|  |  */ | ||||||
|  | function isFeatureAvailable() { | ||||||
|  |     return !!process.env['ACTIONS_CACHE_URL']; | ||||||
|  | } | ||||||
|  | exports.isFeatureAvailable = isFeatureAvailable; | ||||||
| /** | /** | ||||||
|  * Restores cache from keys |  * Restores cache from keys | ||||||
|  * |  * | ||||||
|  | |||||||
							
								
								
									
										78
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										78
									
								
								examples.md
									
									
									
									
									
								
							| @ -45,7 +45,7 @@ | |||||||
| Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies): | Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies): | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ~/.nuget/packages |     path: ~/.nuget/packages | ||||||
|     key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} |     key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | ||||||
| @ -54,10 +54,10 @@ Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/packa | |||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Depending on the environment, huge packages might be pre-installed in the global cache folder. | Depending on the environment, huge packages might be pre-installed in the global cache folder. | ||||||
| With `actions/cache@v2` you can now exclude unwanted packages with [exclude pattern](https://github.com/actions/toolkit/tree/main/packages/glob#exclude-patterns) | With `actions/cache@v3` you can now exclude unwanted packages with [exclude pattern](https://github.com/actions/toolkit/tree/main/packages/glob#exclude-patterns) | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/.nuget/packages |       ~/.nuget/packages | ||||||
| @ -74,7 +74,7 @@ Or you could move the cache folder like below. | |||||||
| env: | env: | ||||||
|   NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages |   NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | ||||||
| steps: | steps: | ||||||
|   - uses: actions/cache@v2 |   - uses: actions/cache@v3 | ||||||
|     with: |     with: | ||||||
|       path: ${{ github.workspace }}/.nuget/packages |       path: ${{ github.workspace }}/.nuget/packages | ||||||
|       key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} |       key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | ||||||
| @ -87,7 +87,7 @@ steps: | |||||||
| ### POSIX | ### POSIX | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ~/.dub |     path: ~/.dub | ||||||
|     key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.json') }} |     key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.json') }} | ||||||
| @ -98,7 +98,7 @@ steps: | |||||||
| ### Windows | ### Windows | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ~\AppData\Local\dub |     path: ~\AppData\Local\dub | ||||||
|     key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.json') }} |     key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.json') }} | ||||||
| @ -111,7 +111,7 @@ steps: | |||||||
| ### Linux | ### Linux | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/.deno |       ~/.deno | ||||||
| @ -122,7 +122,7 @@ steps: | |||||||
| ### macOS | ### macOS | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/.deno |       ~/.deno | ||||||
| @ -133,7 +133,7 @@ steps: | |||||||
| ### Windows | ### Windows | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~\.deno |       ~\.deno | ||||||
| @ -145,7 +145,7 @@ steps: | |||||||
| ## Elixir - Mix | ## Elixir - Mix | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       deps |       deps | ||||||
| @ -160,7 +160,7 @@ steps: | |||||||
| ### Linux | ### Linux | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/.cache/go-build |       ~/.cache/go-build | ||||||
| @ -173,7 +173,7 @@ steps: | |||||||
| ### macOS | ### macOS | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/Library/Caches/go-build |       ~/Library/Caches/go-build | ||||||
| @ -186,7 +186,7 @@ steps: | |||||||
| ### Windows | ### Windows | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~\AppData\Local\go-build |       ~\AppData\Local\go-build | ||||||
| @ -202,7 +202,7 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba | |||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle | - name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle | ||||||
|   uses: actions/cache@v2 |   uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/.cabal/packages |       ~/.cabal/packages | ||||||
| @ -215,14 +215,14 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba | |||||||
| ## Haskell - Stack | ## Haskell - Stack | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   name: Cache ~/.stack |   name: Cache ~/.stack | ||||||
|   with: |   with: | ||||||
|     path: ~/.stack |     path: ~/.stack | ||||||
|     key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }} |     key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }} | ||||||
|     restore-keys: | |     restore-keys: | | ||||||
|       ${{ runner.os }}-stack-global- |       ${{ runner.os }}-stack-global- | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   name: Cache .stack-work |   name: Cache .stack-work | ||||||
|   with: |   with: | ||||||
|     path: .stack-work |     path: .stack-work | ||||||
| @ -236,7 +236,7 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba | |||||||
| >Note: Ensure no Gradle daemons are running anymore when your workflow completes. Creating the cache package might fail due to locks being held by Gradle. Refer to the [Gradle Daemon documentation](https://docs.gradle.org/current/userguide/gradle_daemon.html) on how to disable or stop the Gradle Daemons. | >Note: Ensure no Gradle daemons are running anymore when your workflow completes. Creating the cache package might fail due to locks being held by Gradle. Refer to the [Gradle Daemon documentation](https://docs.gradle.org/current/userguide/gradle_daemon.html) on how to disable or stop the Gradle Daemons. | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/.gradle/caches |       ~/.gradle/caches | ||||||
| @ -250,7 +250,7 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba | |||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - name: Cache local Maven repository | - name: Cache local Maven repository | ||||||
|   uses: actions/cache@v2 |   uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ~/.m2/repository |     path: ~/.m2/repository | ||||||
|     key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |     key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||||||
| @ -269,7 +269,7 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s | |||||||
| ### macOS and Ubuntu | ### macOS and Ubuntu | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ~/.npm |     path: ~/.npm | ||||||
|     key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |     key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||||||
| @ -284,7 +284,7 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s | |||||||
|   id: npm-cache |   id: npm-cache | ||||||
|   run: | |   run: | | ||||||
|     echo "::set-output name=dir::$(npm config get cache)" |     echo "::set-output name=dir::$(npm config get cache)" | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ${{ steps.npm-cache.outputs.dir }} |     path: ${{ steps.npm-cache.outputs.dir }} | ||||||
|     key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |     key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||||||
| @ -299,7 +299,7 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s | |||||||
|   id: npm-cache-dir |   id: npm-cache-dir | ||||||
|   run: | |   run: | | ||||||
|     echo "::set-output name=dir::$(npm config get cache)" |     echo "::set-output name=dir::$(npm config get cache)" | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' |   id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' | ||||||
|   with: |   with: | ||||||
|     path: ${{ steps.npm-cache-dir.outputs.dir }} |     path: ${{ steps.npm-cache-dir.outputs.dir }} | ||||||
| @ -312,7 +312,7 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s | |||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - name: restore lerna | - name: restore lerna | ||||||
|   uses: actions/cache@v2 |   uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: **/node_modules |     path: **/node_modules | ||||||
|     key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |     key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | ||||||
| @ -326,7 +326,7 @@ The yarn cache directory will depend on your operating system and version of `ya | |||||||
|   id: yarn-cache-dir-path |   id: yarn-cache-dir-path | ||||||
|   run: echo "::set-output name=dir::$(yarn cache dir)" |   run: echo "::set-output name=dir::$(yarn cache dir)" | ||||||
|  |  | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |   id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||||||
|   with: |   with: | ||||||
|     path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |     path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||||||
| @ -344,7 +344,7 @@ The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/c | |||||||
|   id: yarn-cache-dir-path |   id: yarn-cache-dir-path | ||||||
|   run: echo "::set-output name=dir::$(yarn config get cacheFolder)" |   run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||||||
|  |  | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |   id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||||||
|   with: |   with: | ||||||
|     path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |     path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||||||
| @ -359,7 +359,7 @@ Esy allows you to export built dependencies and import pre-built dependencies. | |||||||
| ```yaml | ```yaml | ||||||
|     - name: Restore Cache |     - name: Restore Cache | ||||||
|       id: restore-cache |       id: restore-cache | ||||||
|       uses: actions/cache@v2 |       uses: actions/cache@v3 | ||||||
|       with: |       with: | ||||||
|         path: _export |         path: _export | ||||||
|         key:  ${{ runner.os }}-esy-${{ hashFiles('esy.lock/index.json') }} |         key:  ${{ runner.os }}-esy-${{ hashFiles('esy.lock/index.json') }} | ||||||
| @ -388,7 +388,7 @@ Esy allows you to export built dependencies and import pre-built dependencies. | |||||||
|   id: composer-cache |   id: composer-cache | ||||||
|   run: | |   run: | | ||||||
|     echo "::set-output name=dir::$(composer config cache-files-dir)" |     echo "::set-output name=dir::$(composer config cache-files-dir)" | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ${{ steps.composer-cache.outputs.dir }} |     path: ${{ steps.composer-cache.outputs.dir }} | ||||||
|     key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |     key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||||||
| @ -409,7 +409,7 @@ Locations: | |||||||
| ### Simple example | ### Simple example | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ~/.cache/pip |     path: ~/.cache/pip | ||||||
|     key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |     key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||||||
| @ -422,7 +422,7 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu. | |||||||
| ### Multiple OS's in a workflow | ### Multiple OS's in a workflow | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   if: startsWith(runner.os, 'Linux') |   if: startsWith(runner.os, 'Linux') | ||||||
|   with: |   with: | ||||||
|     path: ~/.cache/pip |     path: ~/.cache/pip | ||||||
| @ -430,7 +430,7 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu. | |||||||
|     restore-keys: | |     restore-keys: | | ||||||
|       ${{ runner.os }}-pip- |       ${{ runner.os }}-pip- | ||||||
|  |  | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   if: startsWith(runner.os, 'macOS') |   if: startsWith(runner.os, 'macOS') | ||||||
|   with: |   with: | ||||||
|     path: ~/Library/Caches/pip |     path: ~/Library/Caches/pip | ||||||
| @ -438,7 +438,7 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu. | |||||||
|     restore-keys: | |     restore-keys: | | ||||||
|       ${{ runner.os }}-pip- |       ${{ runner.os }}-pip- | ||||||
|  |  | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   if: startsWith(runner.os, 'Windows') |   if: startsWith(runner.os, 'Windows') | ||||||
|   with: |   with: | ||||||
|     path: ~\AppData\Local\pip\Cache |     path: ~\AppData\Local\pip\Cache | ||||||
| @ -464,7 +464,7 @@ jobs: | |||||||
|         - os: windows-latest |         - os: windows-latest | ||||||
|           path: ~\AppData\Local\pip\Cache |           path: ~\AppData\Local\pip\Cache | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/cache@v2 |     - uses: actions/cache@v3 | ||||||
|       with: |       with: | ||||||
|         path: ${{ matrix.path }} |         path: ${{ matrix.path }} | ||||||
|         key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |         key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||||||
| @ -482,7 +482,7 @@ jobs: | |||||||
|     echo "::set-output name=dir::$(pip cache dir)" |     echo "::set-output name=dir::$(pip cache dir)" | ||||||
|  |  | ||||||
| - name: pip cache | - name: pip cache | ||||||
|   uses: actions/cache@v2 |   uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ${{ steps.pip-cache.outputs.dir }} |     path: ${{ steps.pip-cache.outputs.dir }} | ||||||
|     key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |     key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||||||
| @ -500,7 +500,7 @@ jobs: | |||||||
|  |  | ||||||
|   ⋮ |   ⋮ | ||||||
|  |  | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ~/.local/share/virtualenvs |     path: ~/.local/share/virtualenvs | ||||||
|     key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }} |     key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }} | ||||||
| @ -527,7 +527,7 @@ For renv, the cache directory will vary by OS. The `RENV_PATHS_ROOT` environment | |||||||
|     cat("##[set-output name=r-version;]", R.Version()$version.string, sep = "") |     cat("##[set-output name=r-version;]", R.Version()$version.string, sep = "") | ||||||
|   shell: Rscript {0} |   shell: Rscript {0} | ||||||
| - name: Restore Renv package cache | - name: Restore Renv package cache | ||||||
|   uses: actions/cache@v2 |   uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: ${{ env.RENV_PATHS_ROOT }} |     path: ${{ env.RENV_PATHS_ROOT }} | ||||||
|     key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ inputs.cache-version }}-${{ hashFiles('renv.lock') }} |     key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ inputs.cache-version }}-${{ hashFiles('renv.lock') }} | ||||||
| @ -553,7 +553,7 @@ whenever possible: | |||||||
| ## Rust - Cargo | ## Rust - Cargo | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/.cargo/bin/ |       ~/.cargo/bin/ | ||||||
| @ -568,7 +568,7 @@ whenever possible: | |||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - name: Cache SBT | - name: Cache SBT | ||||||
|   uses: actions/cache@v2 |   uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: | |     path: | | ||||||
|       ~/.ivy2/cache |       ~/.ivy2/cache | ||||||
| @ -579,7 +579,7 @@ whenever possible: | |||||||
| ## Swift, Objective-C - Carthage | ## Swift, Objective-C - Carthage | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: Carthage |     path: Carthage | ||||||
|     key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }} |     key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }} | ||||||
| @ -590,7 +590,7 @@ whenever possible: | |||||||
| ## Swift, Objective-C - CocoaPods | ## Swift, Objective-C - CocoaPods | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: Pods |     path: Pods | ||||||
|     key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} |     key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | ||||||
| @ -601,7 +601,7 @@ whenever possible: | |||||||
| ## Swift - Swift Package Manager | ## Swift - Swift Package Manager | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/cache@v2 | - uses: actions/cache@v3 | ||||||
|   with: |   with: | ||||||
|     path: .build |     path: .build | ||||||
|     key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} |     key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | ||||||
|  | |||||||
							
								
								
									
										7414
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										7414
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										14
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								package.json
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "cache", |   "name": "cache", | ||||||
|   "version": "3.0.0", |   "version": "3.0.1", | ||||||
|   "private": true, |   "private": true, | ||||||
|   "description": "Cache dependencies and build outputs", |   "description": "Cache dependencies and build outputs", | ||||||
|   "main": "dist/restore/index.js", |   "main": "dist/restore/index.js", | ||||||
| @ -23,7 +23,7 @@ | |||||||
|   "author": "GitHub", |   "author": "GitHub", | ||||||
|   "license": "MIT", |   "license": "MIT", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@actions/cache": "^1.0.10", |     "@actions/cache": "^2.0.0", | ||||||
|     "@actions/core": "^1.2.6", |     "@actions/core": "^1.2.6", | ||||||
|     "@actions/exec": "^1.1.1", |     "@actions/exec": "^1.1.1", | ||||||
|     "@actions/io": "^1.1.2" |     "@actions/io": "^1.1.2" | ||||||
| @ -32,20 +32,20 @@ | |||||||
|     "@types/jest": "^27.4.1", |     "@types/jest": "^27.4.1", | ||||||
|     "@types/nock": "^11.1.0", |     "@types/nock": "^11.1.0", | ||||||
|     "@types/node": "^16.11.26", |     "@types/node": "^16.11.26", | ||||||
|     "@typescript-eslint/eslint-plugin": "^5.15.0", |     "@typescript-eslint/eslint-plugin": "^5.16.0", | ||||||
|     "@typescript-eslint/parser": "^5.15.0", |     "@typescript-eslint/parser": "^5.16.0", | ||||||
|     "@zeit/ncc": "^0.20.5", |     "@zeit/ncc": "^0.20.5", | ||||||
|     "eslint": "^8.11.0", |     "eslint": "^8.11.0", | ||||||
|     "eslint-config-prettier": "^8.5.0", |     "eslint-config-prettier": "^8.5.0", | ||||||
|     "eslint-plugin-import": "^2.25.4", |     "eslint-plugin-import": "^2.25.4", | ||||||
|     "eslint-plugin-jest": "^26.1.2", |     "eslint-plugin-jest": "^26.1.3", | ||||||
|     "eslint-plugin-prettier": "^4.0.0", |     "eslint-plugin-prettier": "^4.0.0", | ||||||
|     "eslint-plugin-simple-import-sort": "^7.0.0", |     "eslint-plugin-simple-import-sort": "^7.0.0", | ||||||
|     "jest": "^27.5.1", |     "jest": "^27.5.1", | ||||||
|     "jest-circus": "^27.5.1", |     "jest-circus": "^27.5.1", | ||||||
|     "nock": "^11.7.0", |     "nock": "^11.7.0", | ||||||
|     "prettier": "^2.6.0", |     "prettier": "^2.6.1", | ||||||
|     "ts-jest": "^27.1.3", |     "ts-jest": "^27.1.4", | ||||||
|     "typescript": "^3.9.9" |     "typescript": "^3.9.9" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -6,10 +6,7 @@ import * as utils from "./utils/actionUtils"; | |||||||
|  |  | ||||||
| async function run(): Promise<void> { | async function run(): Promise<void> { | ||||||
|     try { |     try { | ||||||
|         if (utils.isGhes()) { |         if (!utils.isCacheFeatureAvailable()) { | ||||||
|             utils.logWarning( |  | ||||||
|                 "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" |  | ||||||
|             ); |  | ||||||
|             utils.setCacheHitOutput(false); |             utils.setCacheHitOutput(false); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -11,10 +11,7 @@ process.on("uncaughtException", e => utils.logWarning(e.message)); | |||||||
|  |  | ||||||
| async function run(): Promise<void> { | async function run(): Promise<void> { | ||||||
|     try { |     try { | ||||||
|         if (utils.isGhes()) { |         if (!utils.isCacheFeatureAvailable()) { | ||||||
|             utils.logWarning( |  | ||||||
|                 "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" |  | ||||||
|             ); |  | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,3 +1,4 @@ | |||||||
|  | import * as cache from "@actions/cache"; | ||||||
| import * as core from "@actions/core"; | import * as core from "@actions/core"; | ||||||
|  |  | ||||||
| import { Outputs, RefKey, State } from "../constants"; | import { Outputs, RefKey, State } from "../constants"; | ||||||
| @ -74,3 +75,20 @@ export function getInputAsInt( | |||||||
|     } |     } | ||||||
|     return value; |     return value; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | export function isCacheFeatureAvailable(): boolean { | ||||||
|  |     if (!cache.isFeatureAvailable()) { | ||||||
|  |         if (isGhes()) { | ||||||
|  |             logWarning( | ||||||
|  |                 "Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not." | ||||||
|  |             ); | ||||||
|  |         } else { | ||||||
|  |             logWarning( | ||||||
|  |                 "An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions." | ||||||
|  |             ); | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     return true; | ||||||
|  | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	