Documentation unclear on how to specify multiple `restore-keys`
See original GitHub issueDocumentation at https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows states that restore-keys
is “An ordered list of alternative keys to use for finding the cache if no cache hit occurred for key.”. However, if I supply an ordered list for restore-keys
in a job, I get an error:
- name: Cache CVE database for OWASP dependency-check
uses: actions/cache@v3
with:
path: dependency-check-data
key: "${{ runner.os }}-dependency-check-data-${{ hashFiles('**/nvdcve-1.1-modified.meta') }}"
restore-keys:
- "${{ runner.os }}-dependency-check-data-${{ hashFiles('**/nvdcve-1.1-modified.meta') }}"
- "${{ runner.os }}-dependency-check-data-"
Invalid workflow file: .github/workflows/maven.yml#L37 The workflow is not valid. .github/workflows/maven.yml (Line: 37, Col: 13): A sequence was not expected
If this is not how an ordered list should be specified, a more detailed explanation in the documentation would be useful.
The example that does specify multiple restore-keys
does it as a multi-line string, but when I try this the entire string appears to be treated as a single key?
- name: Cache CVE database for OWASP dependency-check
uses: actions/cache@v3
with:
path: dependency-check-data
key: "${{ runner.os }}-dependency-check-data-${{ hashFiles('**/nvdcve-1.1-modified.meta') }}"
restore-keys: |
${{ runner.os }}-dependency-check-data-${{ hashFiles('**/nvdcve-1.1-modified.meta') }}
${{ runner.os }}-dependency-check-data-
Debug output on post-step:
##[debug]Evaluating: format('{0}-dependency-check-data-{1}
##[debug]{2}-dependency-check-data-
##[debug]', runner.os, hashFiles('**/nvdcve-1.1-modified.meta'), runner.os)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> '{0}-dependency-check-data-{1}
##[debug]{2}-dependency-check-data-
##[debug]'
##[debug]..Evaluating Index:
##[debug]....Evaluating runner:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'os'
##[debug]..=> 'Linux'
##[debug]..Evaluating hashFiles:
##[debug]....Evaluating String:
##[debug]....=> '**/nvdcve-1.1-modified.meta'
##[debug]Search root directory: '/home/runner/work/********/********'
##[debug]Search pattern: '**/nvdcve-1.1-modified.meta'
##[debug]Starting process:
##[debug] File name: '/home/runner/runners/2.289.2/externals/node16/bin/node'
##[debug] Arguments: '"/home/runner/runners/2.289.2/bin/hashFiles"'
##[debug] Working directory: '/home/runner/work/********/********'
##[debug] Require exit code zero: 'False'
##[debug] Encoding web name: ; code page: ''
##[debug] Force kill process on cancellation: 'False'
##[debug] Redirected STDIN: 'False'
##[debug] Persist current code page: 'False'
##[debug] Keep redirected STDIN open: 'False'
##[debug] High priority process: 'False'
##[debug]Updated oom_score_adj to 500 for PID: 2010.
##[debug]Process started with process id 2010, waiting for process exit.
##[debug]Match Pattern: **/nvdcve-1.1-modified.meta
##[debug]::debug::followSymbolicLinks 'false'
##[debug]::debug::followSymbolicLinks 'false'
##[debug]::debug::implicitDescendants 'true'
##[debug]::debug::omitBrokenSymbolicLinks 'true'
##[debug]::debug::Search path '/home/runner/work/********/********'
##[debug]/home/runner/work/********/********/dependency-check-data/nvdcache/nvdcve-1.1-modified.meta
##[debug]Found 1 files to hash.
##[debug]Hash result: 'a65b3939924c996fc1daedc8e7c7c4cdf4ea9ec5b7a3c2b495ff37333213'
##[debug]undefined
##[debug]STDOUT/STDERR stream read finished.
##[debug]STDOUT/STDERR stream read finished.
##[debug]Finished process 2010 with exit code 0, and elapsed time 00:00:00.2069719.
##[debug]..=> 'a9394c996fc1da62edc8e7c7c4cdf4ea9ec5b7a3c2b495ff37333213'
##[debug]..Evaluating Index:
##[debug]....Evaluating runner:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'os'
##[debug]..=> 'Linux'
##[debug]=> 'Linux-dependency-check-data-a65b5739924c996fc1da62edc8e7c7c4cdf4ea9ec5b7a3c2b4ff37333213
##[debug]Linux-dependency-check-data-
##[debug]'
##[debug]Result: 'Linux-dependency-check-data-a65b573939924c9fc1da62edc8e7c7c4cdf4ea9ec5b7a3c2b495ff37333213
##[debug]Linux-dependency-check-data-
##[debug]'
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Fixed the docs. @fransf-wtax Thank you for opening. Thanks to @lucascosti for working on it.
Docs change opened in https://github.com/github/docs/pull/16922