mirror of
				https://gitea.com/actions/cache.git
				synced 2025-10-31 07:47:07 +00:00 
			
		
		
		
	Compare commits
	
		
			13 Commits
		
	
	
		
			update_v2
			...
			enableForG
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 5c0fd51138 | ||
|   | 8bcf0245bb | ||
|   | 611465405c | ||
|   | c64c5261d3 | ||
|   | 4e8aa1cc93 | ||
|   | f7a7367bb2 | ||
|   | 3bb5ffcc9c | ||
|   | e6890046a6 | ||
|   | 62fa565f30 | ||
|   | e882008267 | ||
|   | 8e0501dcaf | ||
|   | a3b6799c91 | ||
|   | bd49291365 | 
							
								
								
									
										2
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
								
							| @@ -1 +1 @@ | ||||
| * @actions/artifacts-actions | ||||
| * @actions/actions-cache | ||||
|   | ||||
							
								
								
									
										22
									
								
								.github/workflows/close-inactive-issues.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								.github/workflows/close-inactive-issues.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| name: Close inactive issues | ||||
| on: | ||||
|   schedule: | ||||
|     - cron: "30 8 * * *" | ||||
|  | ||||
| jobs: | ||||
|   close-issues: | ||||
|     runs-on: ubuntu-latest | ||||
|     permissions: | ||||
|       issues: write | ||||
|       pull-requests: write | ||||
|     steps: | ||||
|       - uses: actions/stale@v3 | ||||
|         with: | ||||
|           days-before-issue-stale: 365 | ||||
|           days-before-issue-close: 5 | ||||
|           stale-issue-label: "stale" | ||||
|           stale-issue-message: "This issue is stale because it has been open for 365 days with no activity. Leave a comment to avoid closing this issue in 5 days." | ||||
|           close-issue-message: "This issue was closed because it has been inactive for 5 days since being marked as stale." | ||||
|           days-before-pr-stale: -1 | ||||
|           days-before-pr-close: -1 | ||||
|           repo-token: ${{ secrets.GITHUB_TOKEN }} | ||||
| @@ -143,7 +143,7 @@ See [Using contexts to create cache keys](https://help.github.com/en/actions/con | ||||
|  | ||||
| ## Cache Limits | ||||
|  | ||||
| A repository can have up to 5GB of caches. Once the 5GB limit is reached, older caches will be evicted based on when the cache was last accessed.  Caches that are not accessed within the last week will also be evicted. | ||||
| A repository can have up to 10GB of caches. Once the 10GB limit is reached, older caches will be evicted based on when the cache was last accessed.  Caches that are not accessed within the last week will also be evicted. | ||||
|  | ||||
| ## Skipping steps based on cache-hit | ||||
|  | ||||
| @@ -167,6 +167,12 @@ steps: | ||||
|  | ||||
| > 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 | ||||
| We would love for you to contribute to `actions/cache`, pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information. | ||||
|  | ||||
|   | ||||
| @@ -17,24 +17,6 @@ afterEach(() => { | ||||
|     delete process.env[RefKey]; | ||||
| }); | ||||
|  | ||||
| test("isGhes returns true if server url is not github.com", () => { | ||||
|     try { | ||||
|         process.env["GITHUB_SERVER_URL"] = "http://example.com"; | ||||
|         expect(actionUtils.isGhes()).toBe(true); | ||||
|     } finally { | ||||
|         process.env["GITHUB_SERVER_URL"] = undefined; | ||||
|     } | ||||
| }); | ||||
|  | ||||
| test("isGhes returns true when server url is github.com", () => { | ||||
|     try { | ||||
|         process.env["GITHUB_SERVER_URL"] = "http://github.com"; | ||||
|         expect(actionUtils.isGhes()).toBe(false); | ||||
|     } finally { | ||||
|         process.env["GITHUB_SERVER_URL"] = undefined; | ||||
|     } | ||||
| }); | ||||
|  | ||||
| test("isExactKeyMatch with undefined cache key returns false", () => { | ||||
|     const key = "linux-rust"; | ||||
|     const cacheKey = undefined; | ||||
|   | ||||
| @@ -32,8 +32,6 @@ beforeAll(() => { | ||||
| beforeEach(() => { | ||||
|     process.env[Events.Key] = Events.Push; | ||||
|     process.env[RefKey] = "refs/heads/feature-branch"; | ||||
|  | ||||
|     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); | ||||
| }); | ||||
|  | ||||
| afterEach(() => { | ||||
| @@ -55,23 +53,6 @@ test("restore with invalid event outputs warning", async () => { | ||||
|     expect(failedMock).toHaveBeenCalledTimes(0); | ||||
| }); | ||||
|  | ||||
| test("restore on GHES should no-op", async () => { | ||||
|     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); | ||||
|  | ||||
|     const logWarningMock = jest.spyOn(actionUtils, "logWarning"); | ||||
|     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); | ||||
|     expect(logWarningMock).toHaveBeenCalledWith( | ||||
|         "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| test("restore with no path should fail", async () => { | ||||
|     const failedMock = jest.spyOn(core, "setFailed"); | ||||
|     const restoreCacheMock = jest.spyOn(cache, "restoreCache"); | ||||
|   | ||||
| @@ -52,8 +52,6 @@ beforeAll(() => { | ||||
| beforeEach(() => { | ||||
|     process.env[Events.Key] = Events.Push; | ||||
|     process.env[RefKey] = "refs/heads/feature-branch"; | ||||
|  | ||||
|     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); | ||||
| }); | ||||
|  | ||||
| afterEach(() => { | ||||
| @@ -101,20 +99,6 @@ test("save with no primary key in state outputs warning", async () => { | ||||
|     expect(failedMock).toHaveBeenCalledTimes(0); | ||||
| }); | ||||
|  | ||||
| test("save on GHES should no-op", async () => { | ||||
|     jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); | ||||
|  | ||||
|     const logWarningMock = jest.spyOn(actionUtils, "logWarning"); | ||||
|     const saveCacheMock = jest.spyOn(cache, "saveCache"); | ||||
|  | ||||
|     await run(); | ||||
|  | ||||
|     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 with exact match returns early", async () => { | ||||
|     const infoMock = jest.spyOn(core, "info"); | ||||
|     const failedMock = jest.spyOn(core, "setFailed"); | ||||
|   | ||||
							
								
								
									
										2022
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2022
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2021
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2021
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -168,7 +168,8 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba | ||||
|       ~/.cabal/packages | ||||
|       ~/.cabal/store | ||||
|       dist-newstyle | ||||
|     key: ${{ runner.os }}-${{ matrix.ghc }} | ||||
|     key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }} | ||||
|     restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- | ||||
| ``` | ||||
|  | ||||
| ## Java - Gradle | ||||
|   | ||||
							
								
								
									
										26
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										26
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "cache", | ||||
|   "version": "2.1.8", | ||||
|   "version": "2.1.7", | ||||
|   "lockfileVersion": 1, | ||||
|   "requires": true, | ||||
|   "dependencies": { | ||||
| @@ -21,27 +21,11 @@ | ||||
|       } | ||||
|     }, | ||||
|     "@actions/core": { | ||||
|       "version": "1.10.0", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", | ||||
|       "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", | ||||
|       "version": "1.6.0", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", | ||||
|       "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", | ||||
|       "requires": { | ||||
|         "@actions/http-client": "^2.0.1", | ||||
|         "uuid": "^8.3.2" | ||||
|       }, | ||||
|       "dependencies": { | ||||
|         "@actions/http-client": { | ||||
|           "version": "2.1.0", | ||||
|           "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz", | ||||
|           "integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==", | ||||
|           "requires": { | ||||
|             "tunnel": "^0.0.6" | ||||
|           } | ||||
|         }, | ||||
|         "uuid": { | ||||
|           "version": "8.3.2", | ||||
|           "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", | ||||
|           "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" | ||||
|         } | ||||
|         "@actions/http-client": "^1.0.11" | ||||
|       } | ||||
|     }, | ||||
|     "@actions/exec": { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "cache", | ||||
|   "version": "2.1.8", | ||||
|   "version": "2.1.7", | ||||
|   "private": true, | ||||
|   "description": "Cache dependencies and build outputs", | ||||
|   "main": "dist/restore/index.js", | ||||
| @@ -24,7 +24,7 @@ | ||||
|   "license": "MIT", | ||||
|   "dependencies": { | ||||
|     "@actions/cache": "^1.0.8", | ||||
|     "@actions/core": "^1.10.0", | ||||
|     "@actions/core": "^1.2.6", | ||||
|     "@actions/exec": "^1.0.1", | ||||
|     "@actions/io": "^1.1.0" | ||||
|   }, | ||||
|   | ||||
| @@ -6,14 +6,6 @@ import * as utils from "./utils/actionUtils"; | ||||
|  | ||||
| async function run(): Promise<void> { | ||||
|     try { | ||||
|         if (utils.isGhes()) { | ||||
|             utils.logWarning( | ||||
|                 "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" | ||||
|             ); | ||||
|             utils.setCacheHitOutput(false); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         // Validate inputs, this can cause task failure | ||||
|         if (!utils.isValidEvent()) { | ||||
|             utils.logWarning( | ||||
|   | ||||
| @@ -11,13 +11,6 @@ process.on("uncaughtException", e => utils.logWarning(e.message)); | ||||
|  | ||||
| async function run(): Promise<void> { | ||||
|     try { | ||||
|         if (utils.isGhes()) { | ||||
|             utils.logWarning( | ||||
|                 "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" | ||||
|             ); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if (!utils.isValidEvent()) { | ||||
|             utils.logWarning( | ||||
|                 `Event Validation Error: The event type ${ | ||||
|   | ||||
| @@ -2,13 +2,6 @@ import * as core from "@actions/core"; | ||||
|  | ||||
| import { Outputs, RefKey, State } from "../constants"; | ||||
|  | ||||
| export function isGhes(): boolean { | ||||
|     const ghUrl = new URL( | ||||
|         process.env["GITHUB_SERVER_URL"] || "https://github.com" | ||||
|     ); | ||||
|     return ghUrl.hostname.toUpperCase() !== "GITHUB.COM"; | ||||
| } | ||||
|  | ||||
| export function isExactKeyMatch(key: string, cacheKey?: string): boolean { | ||||
|     return !!( | ||||
|         cacheKey && | ||||
|   | ||||
		Reference in New Issue
	
	Block a user