Compare commits
	
		
			2 Commits
		
	
	
		
			v2.1.6
			...
			dhadka/upd
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 79f581f4b2 | |||
| b12f93aad9 | 
							
								
								
									
										1
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
								
							@ -1 +0,0 @@
 | 
			
		||||
* @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/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.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											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.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.licenses/npm/@opentelemetry/api-0.6.1.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/@opentelemetry/api-0.6.1.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											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/tslib-1.14.1.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.licenses/npm/tslib-1.14.1.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@ -19,6 +19,7 @@ See ["Caching dependencies to speed up workflows"](https://help.github.com/githu
 | 
			
		||||
    path: |
 | 
			
		||||
      ~/cache
 | 
			
		||||
      !~/cache/exclude
 | 
			
		||||
      **/node_modules
 | 
			
		||||
    key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -99,7 +100,6 @@ 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)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20291
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20291
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										20292
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20292
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										87
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										87
									
								
								examples.md
									
									
									
									
									
								
							@ -22,7 +22,6 @@
 | 
			
		||||
    - [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)
 | 
			
		||||
@ -97,14 +96,11 @@ steps:
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Elixir - Mix
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- uses: actions/cache@v2
 | 
			
		||||
  with:
 | 
			
		||||
    path: |
 | 
			
		||||
      deps
 | 
			
		||||
      _build
 | 
			
		||||
    key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
 | 
			
		||||
    path: deps
 | 
			
		||||
    key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-mix-
 | 
			
		||||
```
 | 
			
		||||
@ -137,15 +133,13 @@ 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*', '**/gradle-wrapper.properties') }}
 | 
			
		||||
    key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-gradle-
 | 
			
		||||
```
 | 
			
		||||
@ -200,13 +194,12 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: Get npm cache directory
 | 
			
		||||
  id: npm-cache-dir
 | 
			
		||||
  id: npm-cache
 | 
			
		||||
  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-dir.outputs.dir }}
 | 
			
		||||
    path: ${{ steps.npm-cache.outputs.dir }}
 | 
			
		||||
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-node-
 | 
			
		||||
@ -351,31 +344,6 @@ 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+
 | 
			
		||||
@ -394,15 +362,21 @@ jobs:
 | 
			
		||||
      ${{ runner.os }}-pip-
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Python - pipenv
 | 
			
		||||
### Using a script to get cache location
 | 
			
		||||
 | 
			
		||||
> 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: ~/.local/share/virtualenvs
 | 
			
		||||
    key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }}
 | 
			
		||||
    path: ${{ steps.pip-cache.outputs.dir }}
 | 
			
		||||
    key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-pipenv-
 | 
			
		||||
      ${{ runner.os }}-pip-
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## R - renv
 | 
			
		||||
@ -456,18 +430,21 @@ Replace `~/.local/share/renv` with the correct `path` if not using Ubuntu.
 | 
			
		||||
 | 
			
		||||
## Ruby - 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
 | 
			
		||||
- 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.
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- uses: ruby/setup-ruby@v1
 | 
			
		||||
  with:
 | 
			
		||||
    ruby-version: ...
 | 
			
		||||
    bundler-cache: true
 | 
			
		||||
- name: Bundle install
 | 
			
		||||
  run: |
 | 
			
		||||
    bundle config path vendor/bundle
 | 
			
		||||
    bundle install --jobs 4 --retry 3
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Rust - Cargo
 | 
			
		||||
@ -476,11 +453,9 @@ whenever possible:
 | 
			
		||||
- uses: actions/cache@v2
 | 
			
		||||
  with:
 | 
			
		||||
    path: |
 | 
			
		||||
      ~/.cargo/bin/
 | 
			
		||||
      ~/.cargo/registry/index/
 | 
			
		||||
      ~/.cargo/registry/cache/
 | 
			
		||||
      ~/.cargo/git/db/
 | 
			
		||||
      target/
 | 
			
		||||
      ~/.cargo/registry
 | 
			
		||||
      ~/.cargo/git
 | 
			
		||||
      target
 | 
			
		||||
    key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										911
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										911
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										20
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								package.json
									
									
									
									
									
								
							@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "cache",
 | 
			
		||||
  "version": "2.1.6",
 | 
			
		||||
  "version": "2.1.3",
 | 
			
		||||
  "private": true,
 | 
			
		||||
  "description": "Cache dependencies and build outputs",
 | 
			
		||||
  "main": "dist/restore/index.js",
 | 
			
		||||
@ -23,29 +23,29 @@
 | 
			
		||||
  "author": "GitHub",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@actions/cache": "^1.0.7",
 | 
			
		||||
    "@actions/cache": "^1.0.3",
 | 
			
		||||
    "@actions/core": "^1.2.6",
 | 
			
		||||
    "@actions/exec": "^1.0.1",
 | 
			
		||||
    "@actions/io": "^1.1.0"
 | 
			
		||||
    "@actions/io": "^1.0.1"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/jest": "^24.0.13",
 | 
			
		||||
    "@types/nock": "^11.1.0",
 | 
			
		||||
    "@types/node": "^12.20.7",
 | 
			
		||||
    "@types/node": "^12.0.4",
 | 
			
		||||
    "@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.15.0",
 | 
			
		||||
    "eslint-plugin-import": "^2.22.1",
 | 
			
		||||
    "eslint-plugin-jest": "^23.20.0",
 | 
			
		||||
    "eslint-plugin-prettier": "^3.3.1",
 | 
			
		||||
    "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-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": "^26.5.4",
 | 
			
		||||
    "typescript": "^3.9.9"
 | 
			
		||||
    "ts-jest": "^24.0.2",
 | 
			
		||||
    "typescript": "^3.7.3"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -4,11 +4,6 @@ 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()) {
 | 
			
		||||
@ -49,7 +44,6 @@ 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