mirror of
https://github.com/actions/cache.git
synced 2026-05-13 21:38:06 +00:00
Compare commits
6 Commits
7070a28fc0
...
88d9b9a0de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88d9b9a0de | ||
|
|
27d5ce7f10 | ||
|
|
f280785d7b | ||
|
|
619aeb1606 | ||
|
|
bcf16c2893 | ||
|
|
3b3fb41561 |
BIN
.licenses/npm/@typespec/ts-http-runtime.dep.yml
generated
BIN
.licenses/npm/@typespec/ts-http-runtime.dep.yml
generated
Binary file not shown.
@ -287,3 +287,26 @@ steps:
|
|||||||
- name: Publish package to public
|
- name: Publish package to public
|
||||||
run: ./publish.sh
|
run: ./publish.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Saving cache only if the build runs on the default branch
|
||||||
|
|
||||||
|
Workflow runs can restore caches created in either the current branch or the default branch (usually `main`) [Reference](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache).
|
||||||
|
|
||||||
|
By restricting caches to the default branch, we can reduce the risk that Github evicts a cache created on the default branch. If that happens, every PR will create its own cache, increasing the cache churn.
|
||||||
|
|
||||||
|
We can condition the execution of the `actions/cache/save` action on the current branch:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
.
|
||||||
|
. // restore if need be
|
||||||
|
.
|
||||||
|
- name: Build
|
||||||
|
run: /build.sh
|
||||||
|
- uses: actions/cache/save@v3
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' }} // check we are on the default branch
|
||||||
|
with:
|
||||||
|
path: path/to/dependencies
|
||||||
|
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||||
|
```
|
||||||
4713
dist/restore-only/index.js
vendored
4713
dist/restore-only/index.js
vendored
File diff suppressed because it is too large
Load Diff
4713
dist/restore/index.js
vendored
4713
dist/restore/index.js
vendored
File diff suppressed because it is too large
Load Diff
4713
dist/save-only/index.js
vendored
4713
dist/save-only/index.js
vendored
File diff suppressed because it is too large
Load Diff
4713
dist/save/index.js
vendored
4713
dist/save/index.js
vendored
File diff suppressed because it is too large
Load Diff
6
package-lock.json
generated
6
package-lock.json
generated
@ -1945,9 +1945,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typespec/ts-http-runtime": {
|
"node_modules/@typespec/ts-http-runtime": {
|
||||||
"version": "0.3.2",
|
"version": "0.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.5.tgz",
|
||||||
"integrity": "sha512-IlqQ/Gv22xUC1r/WQm4StLkYQmaaTsXAhUVsNE0+xiyf0yRFiH5++q78U3bw6bLKDCTmh0uqKB9eG9+Bt75Dkg==",
|
"integrity": "sha512-yURCknZhvywvQItHMMmFSo+fq5arCUIyz/CVk7jD89MSai7dkaX8ufjCWp3NttLojoTVbcE72ri+be/TnEbMHw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"http-proxy-agent": "^7.0.0",
|
"http-proxy-agent": "^7.0.0",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user