Compare commits
	
		
			29 Commits
		
	
	
		
			v4.1.0
			...
			dependabot
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 8dbc2f5bee | ||
|   | 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 | ||
|   | 3624ceb22c | 
							
								
								
									
										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 |       issues: write | ||||||
|       pull-requests: write |       pull-requests: write | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/stale@v3 |       - uses: actions/stale@v9 | ||||||
|         with: |         with: | ||||||
|           days-before-issue-stale: 200 |           days-before-issue-stale: 200 | ||||||
|           days-before-issue-close: 5 |           days-before-issue-close: 5 | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								.github/workflows/codeql.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/codeql.yml
									
									
									
									
										vendored
									
									
								
							| @@ -17,11 +17,11 @@ jobs: | |||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout repository |     - name: Checkout repository | ||||||
|       uses: actions/checkout@v3 |       uses: actions/checkout@v4 | ||||||
|  |  | ||||||
|     # Initializes the CodeQL tools for scanning. |     # Initializes the CodeQL tools for scanning. | ||||||
|     - name: Initialize CodeQL |     - 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 |       # Override language selection by uncommenting this and choosing your languages | ||||||
|       # with: |       # with: | ||||||
|       #   languages: go, javascript, csharp, python, cpp, java, ruby |       #   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). |     # 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). |     # If this step fails, then you should remove it and run the build manually (see below). | ||||||
|     - name: Autobuild |     - name: Autobuild | ||||||
|       uses: github/codeql-action/autobuild@v2 |       uses: github/codeql-action/autobuild@v3 | ||||||
|  |  | ||||||
|     # ℹ️ Command-line programs to run using the OS shell. |     # ℹ️ 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 |     # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||||||
| @@ -43,4 +43,4 @@ jobs: | |||||||
|     #     make release |     #     make release | ||||||
|  |  | ||||||
|     - name: Perform CodeQL Analysis |     - name: Perform CodeQL Analysis | ||||||
|       uses: github/codeql-action/analyze@v2 |       uses: github/codeql-action/analyze@v3 | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							| @@ -20,9 +20,9 @@ jobs: | |||||||
|     runs-on: ${{ matrix.os }} |     runs-on: ${{ matrix.os }} | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout |     - name: Checkout | ||||||
|       uses: actions/checkout@v3 |       uses: actions/checkout@v4 | ||||||
|     - name: Setup Node.js 20.x |     - name: Setup Node.js 20.x | ||||||
|       uses: actions/setup-node@v3 |       uses: actions/setup-node@v4 | ||||||
|       with: |       with: | ||||||
|         node-version: 20.x |         node-version: 20.x | ||||||
|         cache: npm |         cache: npm | ||||||
| @@ -43,7 +43,7 @@ jobs: | |||||||
|     runs-on: ${{ matrix.os }} |     runs-on: ${{ matrix.os }} | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout |     - name: Checkout | ||||||
|       uses: actions/checkout@v3 |       uses: actions/checkout@v4 | ||||||
|     - name: Generate files in working directory |     - name: Generate files in working directory | ||||||
|       shell: bash |       shell: bash | ||||||
|       run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache |       run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache | ||||||
| @@ -66,7 +66,7 @@ jobs: | |||||||
|     runs-on: ${{ matrix.os }} |     runs-on: ${{ matrix.os }} | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout |     - name: Checkout | ||||||
|       uses: actions/checkout@v3 |       uses: actions/checkout@v4 | ||||||
|     - name: Restore cache |     - name: Restore cache | ||||||
|       uses: ./ |       uses: ./ | ||||||
|       with: |       with: | ||||||
| @@ -96,7 +96,7 @@ jobs: | |||||||
|       https_proxy: http://squid-proxy:3128 |       https_proxy: http://squid-proxy:3128 | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout |     - name: Checkout | ||||||
|       uses: actions/checkout@v3 |       uses: actions/checkout@v4 | ||||||
|     - name: Generate files |     - name: Generate files | ||||||
|       run: __tests__/create-cache-files.sh proxy test-cache |       run: __tests__/create-cache-files.sh proxy test-cache | ||||||
|     - name: Save cache |     - name: Save cache | ||||||
| @@ -119,7 +119,7 @@ jobs: | |||||||
|       https_proxy: http://squid-proxy:3128 |       https_proxy: http://squid-proxy:3128 | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout |     - name: Checkout | ||||||
|       uses: actions/checkout@v3 |       uses: actions/checkout@v4 | ||||||
|     - name: Restore cache |     - name: Restore cache | ||||||
|       uses: ./ |       uses: ./ | ||||||
|       with: |       with: | ||||||
|   | |||||||
| @@ -64,9 +64,9 @@ If you are using a `self-hosted` Windows runner, `GNU tar` and `zstd` are requir | |||||||
|  |  | ||||||
| ### Outputs | ### Outputs | ||||||
|  |  | ||||||
| * `cache-hit` - A boolean value to indicate an exact match was found for the key. | * `cache-hit` - A string value to indicate an exact match was found for the key. | ||||||
|  |   * If there's a cache hit, this will be 'true' or 'false' to indicate if there's an exact match for `key`. | ||||||
|     > **Note** `cache-hit` will only be set to `true` when a cache hit occurs for the exact `key` match. For a partial key match via `restore-keys` or a cache miss, it will be set to `false`. |   * If there's a cache miss, this will be an empty string. | ||||||
|  |  | ||||||
| See [Skipping steps based on cache-hit](#skipping-steps-based-on-cache-hit) for info on using this output | See [Skipping steps based on cache-hit](#skipping-steps-based-on-cache-hit) for info on using this output | ||||||
|  |  | ||||||
| @@ -157,6 +157,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: | See [Examples](examples.md) for a list of `actions/cache` implementations for use with: | ||||||
|  |  | ||||||
|  | * [Bun](./examples.md#bun) | ||||||
| * [C# - NuGet](./examples.md#c---nuget) | * [C# - NuGet](./examples.md#c---nuget) | ||||||
| * [Clojure - Lein Deps](./examples.md#clojure---lein-deps) | * [Clojure - Lein Deps](./examples.md#clojure---lein-deps) | ||||||
| * [D - DUB](./examples.md#d---dub) | * [D - DUB](./examples.md#d---dub) | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								RELEASES.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								RELEASES.md
									
									
									
									
									
								
							| @@ -1,6 +1,16 @@ | |||||||
| # Releases | # Releases | ||||||
|  |  | ||||||
|  | ### 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 | ### 4.1.0 | ||||||
|  |  | ||||||
| - Ensure `cache-hit` output is set when a cache is missed - [#1404](https://github.com/actions/cache/pull/1404) | - 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) | - Deprecate `save-always` input - [#1452](https://github.com/actions/cache/pull/1452) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,17 +8,26 @@ import * as testUtils from "../src/utils/testUtils"; | |||||||
| jest.mock("@actions/core"); | jest.mock("@actions/core"); | ||||||
| jest.mock("@actions/cache"); | jest.mock("@actions/cache"); | ||||||
|  |  | ||||||
|  | let pristineEnv: NodeJS.ProcessEnv; | ||||||
|  |  | ||||||
| beforeAll(() => { | beforeAll(() => { | ||||||
|  |     pristineEnv = process.env; | ||||||
|     jest.spyOn(core, "getInput").mockImplementation((name, options) => { |     jest.spyOn(core, "getInput").mockImplementation((name, options) => { | ||||||
|         return jest.requireActual("@actions/core").getInput(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[Events.Key]; | ||||||
|     delete process.env[RefKey]; |     delete process.env[RefKey]; | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | afterAll(() => { | ||||||
|  |     process.env = pristineEnv; | ||||||
|  | }); | ||||||
|  |  | ||||||
| test("isGhes returns true if server url is not github.com", () => { | test("isGhes returns true if server url is not github.com", () => { | ||||||
|     try { |     try { | ||||||
|         process.env["GITHUB_SERVER_URL"] = "http://example.com"; |         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"]; |         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(); | ||||||
|  | }); | ||||||
|   | |||||||
| @@ -260,7 +260,7 @@ test("Fail restore when fail on cache miss is enabled and primary + restore keys | |||||||
|     ); |     ); | ||||||
|  |  | ||||||
|     expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); |     expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); | ||||||
|     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); |     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(0); | ||||||
|  |  | ||||||
|     expect(failedMock).toHaveBeenCalledWith( |     expect(failedMock).toHaveBeenCalledWith( | ||||||
|         `Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${key}` |         `Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${key}` | ||||||
|   | |||||||
| @@ -86,8 +86,7 @@ test("restore with no cache found", async () => { | |||||||
|     ); |     ); | ||||||
|  |  | ||||||
|     expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); |     expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); | ||||||
|     expect(outputMock).toHaveBeenCalledWith("cache-hit", "false"); |     expect(outputMock).toHaveBeenCalledTimes(1); | ||||||
|     expect(outputMock).toHaveBeenCalledTimes(2); |  | ||||||
|     expect(failedMock).toHaveBeenCalledTimes(0); |     expect(failedMock).toHaveBeenCalledTimes(0); | ||||||
|  |  | ||||||
|     expect(infoMock).toHaveBeenCalledWith( |     expect(infoMock).toHaveBeenCalledWith( | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -59415,7 +59415,8 @@ function restoreImpl(stateProvider, earlyExit) { | |||||||
|             const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly); |             const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly); | ||||||
|             const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive); |             const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive); | ||||||
|             if (!cacheKey) { |             if (!cacheKey) { | ||||||
|                 core.setOutput(constants_1.Outputs.CacheHit, false.toString()); |                 // `cache-hit` is intentionally not set to `false` here to preserve existing behavior
 | ||||||
|  |                 // See https://github.com/actions/cache/issues/1466
 | ||||||
|                 if (failOnCacheMiss) { |                 if (failOnCacheMiss) { | ||||||
|                     throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`); |                     throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`); | ||||||
|                 } |                 } | ||||||
| @@ -59585,7 +59586,11 @@ const core = __importStar(__nccwpck_require__(2186)); | |||||||
| const constants_1 = __nccwpck_require__(9042); | const constants_1 = __nccwpck_require__(9042); | ||||||
| function isGhes() { | function isGhes() { | ||||||
|     const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com"); |     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; | ||||||
| } | } | ||||||
| exports.isGhes = isGhes; | exports.isGhes = isGhes; | ||||||
| function isExactKeyMatch(key, cacheKey) { | function isExactKeyMatch(key, cacheKey) { | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -59415,7 +59415,8 @@ function restoreImpl(stateProvider, earlyExit) { | |||||||
|             const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly); |             const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly); | ||||||
|             const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive); |             const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive); | ||||||
|             if (!cacheKey) { |             if (!cacheKey) { | ||||||
|                 core.setOutput(constants_1.Outputs.CacheHit, false.toString()); |                 // `cache-hit` is intentionally not set to `false` here to preserve existing behavior
 | ||||||
|  |                 // See https://github.com/actions/cache/issues/1466
 | ||||||
|                 if (failOnCacheMiss) { |                 if (failOnCacheMiss) { | ||||||
|                     throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`); |                     throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`); | ||||||
|                 } |                 } | ||||||
| @@ -59585,7 +59586,11 @@ const core = __importStar(__nccwpck_require__(2186)); | |||||||
| const constants_1 = __nccwpck_require__(9042); | const constants_1 = __nccwpck_require__(9042); | ||||||
| function isGhes() { | function isGhes() { | ||||||
|     const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com"); |     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; | ||||||
| } | } | ||||||
| exports.isGhes = isGhes; | exports.isGhes = isGhes; | ||||||
| function isExactKeyMatch(key, cacheKey) { | function isExactKeyMatch(key, cacheKey) { | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -59599,7 +59599,11 @@ const core = __importStar(__nccwpck_require__(2186)); | |||||||
| const constants_1 = __nccwpck_require__(9042); | const constants_1 = __nccwpck_require__(9042); | ||||||
| function isGhes() { | function isGhes() { | ||||||
|     const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com"); |     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; | ||||||
| } | } | ||||||
| exports.isGhes = isGhes; | exports.isGhes = isGhes; | ||||||
| function isExactKeyMatch(key, cacheKey) { | function isExactKeyMatch(key, cacheKey) { | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -59599,7 +59599,11 @@ const core = __importStar(__nccwpck_require__(2186)); | |||||||
| const constants_1 = __nccwpck_require__(9042); | const constants_1 = __nccwpck_require__(9042); | ||||||
| function isGhes() { | function isGhes() { | ||||||
|     const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com"); |     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; | ||||||
| } | } | ||||||
| exports.isGhes = isGhes; | exports.isGhes = isGhes; | ||||||
| function isExactKeyMatch(key, cacheKey) { | function isExactKeyMatch(key, cacheKey) { | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								examples.md
									
									
									
									
									
								
							| @@ -1,5 +1,6 @@ | |||||||
| # Examples | # Examples | ||||||
|  |  | ||||||
|  | - [Bun](#bun) | ||||||
| - [C# - NuGet](#c---nuget) | - [C# - NuGet](#c---nuget) | ||||||
| - [Clojure - Lein Deps](#clojure---lein-deps) | - [Clojure - Lein Deps](#clojure---lein-deps) | ||||||
| - [D - DUB](#d---dub) | - [D - DUB](#d---dub) | ||||||
| @@ -41,6 +42,26 @@ | |||||||
| - [Swift - Mint](#swift---mint) | - [Swift - Mint](#swift---mint) | ||||||
| - [* - Bazel](#---bazel) | - [* - 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 | ## C# - NuGet | ||||||
|  |  | ||||||
| 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): | ||||||
|   | |||||||
							
								
								
									
										3184
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3184
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "cache", |   "name": "cache", | ||||||
|   "version": "4.1.0", |   "version": "4.1.2", | ||||||
|   "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", | ||||||
| @@ -42,10 +42,10 @@ | |||||||
|     "eslint-plugin-prettier": "^4.2.1", |     "eslint-plugin-prettier": "^4.2.1", | ||||||
|     "eslint-plugin-simple-import-sort": "^7.0.0", |     "eslint-plugin-simple-import-sort": "^7.0.0", | ||||||
|     "jest": "^28.1.3", |     "jest": "^28.1.3", | ||||||
|     "jest-circus": "^27.5.1", |     "jest-circus": "^29.7.0", | ||||||
|     "nock": "^13.2.9", |     "nock": "^13.2.9", | ||||||
|     "prettier": "^2.8.0", |     "prettier": "^2.8.0", | ||||||
|     "ts-jest": "^28.0.8", |     "ts-jest": "^28.0.8", | ||||||
|     "typescript": "^4.9.3" |     "typescript": "^4.9.3" | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @@ -51,7 +51,9 @@ export async function restoreImpl( | |||||||
|         ); |         ); | ||||||
|  |  | ||||||
|         if (!cacheKey) { |         if (!cacheKey) { | ||||||
|             core.setOutput(Outputs.CacheHit, false.toString()); |             // `cache-hit` is intentionally not set to `false` here to preserve existing behavior | ||||||
|  |             // See https://github.com/actions/cache/issues/1466 | ||||||
|  |  | ||||||
|             if (failOnCacheMiss) { |             if (failOnCacheMiss) { | ||||||
|                 throw new Error( |                 throw new Error( | ||||||
|                     `Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}` |                     `Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}` | ||||||
|   | |||||||
| @@ -7,7 +7,13 @@ export function isGhes(): boolean { | |||||||
|     const ghUrl = new URL( |     const ghUrl = new URL( | ||||||
|         process.env["GITHUB_SERVER_URL"] || "https://github.com" |         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 { | export function isExactKeyMatch(key: string, cacheKey?: string): boolean { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user