Compare commits
	
		
			34 Commits
		
	
	
		
			v2.1.2
			...
			dhadka/fix
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| fe3965aede | |||
| 67324ade11 | |||
| cc2d767a72 | |||
| 2fa955d825 | |||
| 3a696372f2 | |||
| 366e5ba022 | |||
| 8d3f2fc3ce | |||
| 1a9e2138d9 | |||
| 981fa981ed | |||
| 4498c5b4d8 | |||
| 4134e6de47 | |||
| 26968a09c0 | |||
| aeaf731ae2 | |||
| 56a8a2f775 | |||
| 1bfe3accb3 | |||
| 354332455a | |||
| 3303695afa | |||
| e64ab303d1 | |||
| 26c48dce83 | |||
| 72f66cfa6d | |||
| 9f3a4d3e65 | |||
| 7b630ee04f | |||
| d2583f08bc | |||
| 752e778edb | |||
| a3047dcdce | |||
| 9c77c9dbfc | |||
| 29cdd22c60 | |||
| 62a4d75442 | |||
| 0781355a23 | |||
| 22c64ac772 | |||
| cbbf882ea4 | |||
| 4557c6a937 | |||
| 8819edf476 | |||
| 19530ba135 | 
							
								
								
									
										1
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| * @actions/artifacts-actions | ||||
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@actions/glob.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@actions/glob.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@actions/http-client.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@actions/http-client.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@actions/io.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@actions/io.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@azure/abort-controller.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@azure/abort-controller.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-auth.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-auth.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-http.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-http.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-lro.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-lro.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-paging.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-paging.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-tracing-1.0.0-preview.11.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@azure/core-tracing-1.0.0-preview.11.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@azure/logger.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@azure/logger.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@azure/ms-rest-js.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@azure/ms-rest-js.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@azure/storage-blob.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@azure/storage-blob.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@opentelemetry/api-1.0.0-rc.0.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@opentelemetry/api-1.0.0-rc.0.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@opentelemetry/context-base.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@opentelemetry/context-base.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@types/node-fetch.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@types/node-fetch.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@types/node.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@types/node.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/events.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/events.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/node-fetch.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/node-fetch.dep.yml
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -19,7 +19,6 @@ See ["Caching dependencies to speed up workflows"](https://help.github.com/githu | ||||
|     path: | | ||||
|       ~/cache | ||||
|       !~/cache/exclude | ||||
|       **/node_modules | ||||
|     key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||||
| ``` | ||||
|  | ||||
| @ -100,6 +99,7 @@ See [Examples](examples.md) for a list of `actions/cache` implementations for us | ||||
| - [OCaml/Reason - esy](./examples.md#ocamlreason---esy) | ||||
| - [PHP - Composer](./examples.md#php---composer) | ||||
| - [Python - pip](./examples.md#python---pip) | ||||
| - [Python - pipenv](./examples.md#python---pipenv) | ||||
| - [R - renv](./examples.md#r---renv) | ||||
| - [Ruby - Bundler](./examples.md#ruby---bundler) | ||||
| - [Rust - Cargo](./examples.md#rust---cargo) | ||||
|  | ||||
							
								
								
									
										27760
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										27760
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										27761
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										27761
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										87
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										87
									
								
								examples.md
									
									
									
									
									
								
							| @ -22,6 +22,7 @@ | ||||
|     - [Multiple OSes in a workflow](#multiple-oss-in-a-workflow) | ||||
|     - [Using pip to get cache location](#using-pip-to-get-cache-location) | ||||
|     - [Using a script to get cache location](#using-a-script-to-get-cache-location) | ||||
|   - [Python - pipenv](#python---pipenv) | ||||
|   - [R - renv](#r---renv) | ||||
|     - [Simple example](#simple-example-1) | ||||
|     - [Multiple OSes in a workflow](#multiple-oss-in-a-workflow-1) | ||||
| @ -96,11 +97,14 @@ steps: | ||||
| ``` | ||||
|  | ||||
| ## Elixir - Mix | ||||
|  | ||||
| ```yaml | ||||
| - uses: actions/cache@v2 | ||||
|   with: | ||||
|     path: deps | ||||
|     key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | ||||
|     path: | | ||||
|       deps | ||||
|       _build | ||||
|     key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | ||||
|     restore-keys: | | ||||
|       ${{ runner.os }}-mix- | ||||
| ``` | ||||
| @ -133,13 +137,15 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba | ||||
|  | ||||
| ## Java - Gradle | ||||
|  | ||||
| >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 | ||||
| - uses: actions/cache@v2 | ||||
|   with: | ||||
|     path: | | ||||
|       ~/.gradle/caches | ||||
|       ~/.gradle/wrapper | ||||
|     key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||||
|     key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||||
|     restore-keys: | | ||||
|       ${{ runner.os }}-gradle- | ||||
| ``` | ||||
| @ -194,12 +200,13 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s | ||||
|  | ||||
| ```yaml | ||||
| - name: Get npm cache directory | ||||
|   id: npm-cache | ||||
|   id: npm-cache-dir | ||||
|   run: | | ||||
|     echo "::set-output name=dir::$(npm config get cache)" | ||||
| - uses: actions/cache@v2 | ||||
|   id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' | ||||
|   with: | ||||
|     path: ${{ steps.npm-cache.outputs.dir }} | ||||
|     path: ${{ steps.npm-cache-dir.outputs.dir }} | ||||
|     key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||||
|     restore-keys: | | ||||
|       ${{ runner.os }}-node- | ||||
| @ -344,6 +351,31 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu. | ||||
|       ${{ runner.os }}-pip- | ||||
| ``` | ||||
|  | ||||
| ### Multiple OS's in a workflow with a matrix | ||||
|  | ||||
| ``` yaml | ||||
| jobs: | ||||
|   build: | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, macos-latest, windows-latest] | ||||
|         include: | ||||
|         - os: ubuntu-latest | ||||
|           path: ~/.cache/pip | ||||
|         - os: macos-latest | ||||
|           path: ~/Library/Caches/pip | ||||
|         - os: windows-latest | ||||
|           path: ~\AppData\Local\pip\Cache | ||||
|     steps: | ||||
|     - uses: actions/cache@v2 | ||||
|       with: | ||||
|         path: ${{ matrix.path }} | ||||
|         key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||||
|         restore-keys: | | ||||
|          ${{ runner.os }}-pip- | ||||
| ``` | ||||
|  | ||||
| ### Using pip to get cache location | ||||
|  | ||||
| > Note: This requires pip 20.1+ | ||||
| @ -362,21 +394,15 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu. | ||||
|       ${{ runner.os }}-pip- | ||||
| ``` | ||||
|  | ||||
| ### Using a script to get cache location | ||||
| ## Python - pipenv | ||||
|  | ||||
| > Note: This uses an internal pip API and may not always work | ||||
| ```yaml | ||||
| - name: Get pip cache dir | ||||
|   id: pip-cache | ||||
|   run: | | ||||
|     python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)" | ||||
|  | ||||
| - uses: actions/cache@v2 | ||||
|   with: | ||||
|     path: ${{ steps.pip-cache.outputs.dir }} | ||||
|     key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||||
|     path: ~/.local/share/virtualenvs | ||||
|     key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }} | ||||
|     restore-keys: | | ||||
|       ${{ runner.os }}-pip- | ||||
|       ${{ runner.os }}-pipenv- | ||||
| ``` | ||||
|  | ||||
| ## R - renv | ||||
| @ -430,21 +456,18 @@ Replace `~/.local/share/renv` with the correct `path` if not using Ubuntu. | ||||
|  | ||||
| ## Ruby - Bundler | ||||
|  | ||||
| ```yaml | ||||
| - uses: actions/cache@v2 | ||||
|   with: | ||||
|     path: vendor/bundle | ||||
|     key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | ||||
|     restore-keys: | | ||||
|       ${{ runner.os }}-gems- | ||||
| ``` | ||||
| When dependencies are installed later in the workflow, we must specify the same path for the bundler. | ||||
| Caching gems with Bundler correctly is not trivial and just using `actions/cache` | ||||
| is [not enough](https://github.com/ruby/setup-ruby#caching-bundle-install-manually). | ||||
|  | ||||
| Instead, it is recommended to use `ruby/setup-ruby`'s | ||||
| [`bundler-cache: true` option](https://github.com/ruby/setup-ruby#caching-bundle-install-automatically) | ||||
| whenever possible: | ||||
|  | ||||
| ```yaml | ||||
| - name: Bundle install | ||||
|   run: | | ||||
|     bundle config path vendor/bundle | ||||
|     bundle install --jobs 4 --retry 3 | ||||
| - uses: ruby/setup-ruby@v1 | ||||
|   with: | ||||
|     ruby-version: ... | ||||
|     bundler-cache: true | ||||
| ``` | ||||
|  | ||||
| ## Rust - Cargo | ||||
| @ -453,9 +476,11 @@ When dependencies are installed later in the workflow, we must specify the same | ||||
| - uses: actions/cache@v2 | ||||
|   with: | ||||
|     path: | | ||||
|       ~/.cargo/registry | ||||
|       ~/.cargo/git | ||||
|       target | ||||
|       ~/.cargo/bin/ | ||||
|       ~/.cargo/registry/index/ | ||||
|       ~/.cargo/registry/cache/ | ||||
|       ~/.cargo/git/db/ | ||||
|       target/ | ||||
|     key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||||
| ``` | ||||
|  | ||||
|  | ||||
							
								
								
									
										921
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										921
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										22
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								package.json
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "cache", | ||||
|   "version": "2.1.2", | ||||
|   "version": "2.1.6", | ||||
|   "private": true, | ||||
|   "description": "Cache dependencies and build outputs", | ||||
|   "main": "dist/restore/index.js", | ||||
| @ -23,29 +23,29 @@ | ||||
|   "author": "GitHub", | ||||
|   "license": "MIT", | ||||
|   "dependencies": { | ||||
|     "@actions/core": "^1.2.0", | ||||
|     "@actions/cache": "^1.0.7", | ||||
|     "@actions/core": "^1.2.6", | ||||
|     "@actions/exec": "^1.0.1", | ||||
|     "@actions/io": "^1.0.1", | ||||
|     "@actions/cache": "^1.0.2" | ||||
|     "@actions/io": "^1.1.0" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@types/jest": "^24.0.13", | ||||
|     "@types/nock": "^11.1.0", | ||||
|     "@types/node": "^12.0.4", | ||||
|     "@types/node": "^12.20.7", | ||||
|     "@typescript-eslint/eslint-plugin": "^2.7.0", | ||||
|     "@typescript-eslint/parser": "^2.7.0", | ||||
|     "@zeit/ncc": "^0.20.5", | ||||
|     "eslint": "^6.6.0", | ||||
|     "eslint-config-prettier": "^6.5.0", | ||||
|     "eslint-plugin-import": "^2.18.2", | ||||
|     "eslint-plugin-jest": "^23.0.3", | ||||
|     "eslint-plugin-prettier": "^3.1.1", | ||||
|     "eslint-config-prettier": "^6.15.0", | ||||
|     "eslint-plugin-import": "^2.22.1", | ||||
|     "eslint-plugin-jest": "^23.20.0", | ||||
|     "eslint-plugin-prettier": "^3.3.1", | ||||
|     "eslint-plugin-simple-import-sort": "^5.0.2", | ||||
|     "jest": "^24.8.0", | ||||
|     "jest-circus": "^24.7.1", | ||||
|     "nock": "^11.7.0", | ||||
|     "prettier": "^1.19.1", | ||||
|     "ts-jest": "^24.0.2", | ||||
|     "typescript": "^3.7.3" | ||||
|     "ts-jest": "^26.5.4", | ||||
|     "typescript": "^3.9.9" | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -4,6 +4,11 @@ import * as core from "@actions/core"; | ||||
| import { Events, Inputs, State } from "./constants"; | ||||
| import * as utils from "./utils/actionUtils"; | ||||
|  | ||||
| // Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in | ||||
| // @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to | ||||
| // throw an uncaught exception.  Instead of failing this action, just warn. | ||||
| process.on("uncaughtException", e => utils.logWarning(e.message)); | ||||
|  | ||||
| async function run(): Promise<void> { | ||||
|     try { | ||||
|         if (utils.isGhes()) { | ||||
| @ -44,6 +49,7 @@ async function run(): Promise<void> { | ||||
|             await cache.saveCache(cachePaths, primaryKey, { | ||||
|                 uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize) | ||||
|             }); | ||||
|             core.info(`Cache saved with key: ${primaryKey}`); | ||||
|         } catch (error) { | ||||
|             if (error.name === cache.ValidationError.name) { | ||||
|                 throw error; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	