Compare commits

...

19 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
e9bc7be075 Add PR triage report with categorized analysis of 51 open PRs
Co-authored-by: Link- <568794+Link-@users.noreply.github.com>
2026-01-29 10:49:22 +00:00
copilot-swe-agent[bot]
b702dcd123 Initial plan 2026-01-29 10:45:15 +00:00
Bassem Dghaidi
b45623637f Merge pull request #1690 from XZTDean/docs/v5-example-update
Some checks failed
Check dist content / Check dist/ (push) Failing after 0s
Tests / build (macOS-latest) (push) Waiting to run
Tests / build (windows-latest) (push) Waiting to run
Tests / test-save (macOS-latest) (push) Waiting to run
Tests / test-save (windows-latest) (push) Waiting to run
Tests / test-restore (macOS-latest) (push) Blocked by required conditions
Tests / test-restore (ubuntu-latest) (push) Blocked by required conditions
Tests / test-restore (windows-latest) (push) Blocked by required conditions
Tests / test-save (ubuntu-latest) (push) Successful in 22s
Tests / test-proxy-save (push) Failing after 22s
Tests / test-proxy-restore (push) Has been skipped
Code scanning / CodeQL-Build (push) Failing after 1m3s
Tests / build (ubuntu-latest) (push) Successful in 1m5s
License check / Check licenses (push) Failing after 1m16s
docs: Update examples to use the latest version
2026-01-29 11:36:35 +01:00
Bassem Dghaidi
bdb94ce451 Merge branch 'main' into docs/v5-example-update 2026-01-29 11:32:26 +01:00
Bassem Dghaidi
cb6ea63971 Merge pull request #1699 from actions/Link-/fix-workflow-permissions
Fix workflow permissions and cleanup workflow names / formatting
2026-01-29 11:31:19 +01:00
Bassem Dghaidi
49bc452f55 Merge branch 'Link-/fix-workflow-permissions' of github.com:actions/cache into Link-/fix-workflow-permissions 2026-01-29 02:27:40 -08:00
Bassem Dghaidi
1e06c934a1 Merge branch 'main' of github.com:actions/cache into Link-/fix-workflow-permissions 2026-01-29 02:27:32 -08:00
Bassem Dghaidi
a838313d22 Merge pull request #1697 from actions/alert-autofix-52
Potential fix for code scanning alert no. 52: Workflow does not contain permissions
2026-01-29 11:26:02 +01:00
Bassem Dghaidi
6e48a73476 Update .github/workflows/pr-opened-workflow.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-29 11:25:11 +01:00
Bassem Dghaidi
9848277c90 Cleanup workflow file names 2026-01-29 02:19:45 -08:00
Bassem Dghaidi
94056f1871 Fix workflow permissions and cleanup 2026-01-29 02:17:35 -08:00
Bassem Dghaidi
b56bb3a202 Fix permissions for workflows/workflow.yml 2026-01-29 02:11:09 -08:00
Bassem Dghaidi
4a6586c009 Merge branch 'main' into alert-autofix-52 2026-01-29 11:04:16 +01:00
Bassem Dghaidi
0de23fd4eb Merge pull request #1696 from actions/Link-/release-docs
Add release instructions and update maintainer docs
2026-01-29 11:03:40 +01:00
Bassem Dghaidi
4e38c8636e Potential fix for code scanning alert no. 52: Workflow does not contain permissions
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-01-29 11:02:45 +01:00
Bassem Dghaidi
24e8b877a8 Add note 2026-01-29 01:58:41 -08:00
Bassem Dghaidi
3baa5f1c7b Update contribution docs 2026-01-29 01:58:05 -08:00
XZTDean
5b7a9f8ae5 docs: Update other actions in examples to the latest version 2025-12-15 06:34:21 -08:00
XZTDean
de99935c0c docs: Update examples to cache@v5 2025-12-15 06:15:33 -08:00
18 changed files with 296 additions and 136 deletions

View File

@@ -1,4 +1,4 @@
name: Check dist/
name: Check dist content
on:
push:
@@ -11,6 +11,9 @@ on:
- '**.md'
workflow_dispatch:
permissions:
contents: read
jobs:
call-check-dist:
name: Check dist/

View File

@@ -1,4 +1,5 @@
name: Close inactive issues
on:
schedule:
- cron: "30 8 * * *"

View File

@@ -1,4 +1,4 @@
name: "Code scanning - action"
name: Code scanning
on:
push:
@@ -6,15 +6,14 @@ on:
schedule:
- cron: '0 19 * * 0'
permissions:
contents: read
security-events: write
jobs:
CodeQL-Build:
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v5

View File

@@ -1,16 +1,21 @@
name: Assign issue
on:
issues:
types: [opened]
permissions:
issues: write
jobs:
run-action:
runs-on: ubuntu-latest
steps:
- name: Get current oncall
id: oncall
run: |
echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
- name: add_assignees
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.issue.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'
- name: Get current oncall
id: oncall
run: |
echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
- name: add_assignees
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.issue.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'

View File

@@ -1,4 +1,4 @@
name: Licensed
name: License check
on:
push:
@@ -9,6 +9,9 @@ on:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
validate-cached-dependency-records:
runs-on: ubuntu-latest

View File

@@ -1,20 +1,25 @@
name: Add Reviewer PR
name: Assign pull request reviewer
on:
pull_request_target:
types: [opened]
permissions:
pull-requests: write
jobs:
run-action:
runs-on: ubuntu-latest
steps:
- name: Get current oncall
id: oncall
run: |
echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
- name: Request Review
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/pulls/${{ github.event.pull_request.number}}/requested_reviewers -d '{"reviewers":["${{steps.oncall.outputs.CURRENT}}"]}'
- name: Add Assignee
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.pull_request.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'
- name: Get current oncall
id: oncall
run: |
echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
- name: Request Review
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/pulls/${{ github.event.pull_request.number}}/requested_reviewers -d '{"reviewers":["${{steps.oncall.outputs.CURRENT}}"]}'
- name: Add Assignee
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.pull_request.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'

View File

@@ -1,17 +1,17 @@
name: 'Publish Immutable Action Version'
name: Publish immutable action
on:
release:
types: [released]
permissions:
contents: read
id-token: write
packages: write
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checking out
uses: actions/checkout@v5

View File

@@ -1,4 +1,5 @@
name: Release new action version
on:
release:
types: [released]
@@ -10,6 +11,7 @@ on:
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
permissions:
contents: write

View File

@@ -10,6 +10,9 @@ on:
- main
- releases/**
permissions:
contents: read
jobs:
# Build and unit test
build:
@@ -57,6 +60,7 @@ jobs:
path: |
test-cache
~/test-cache
test-restore:
needs: test-save
strategy:
@@ -104,6 +108,7 @@ jobs:
with:
key: test-proxy-${{ github.run_id }}
path: test-cache
test-proxy-restore:
needs: test-proxy-save
runs-on: ubuntu-latest

View File

@@ -16,7 +16,7 @@ Please note that this project is released with a [Contributor Code of Conduct][c
1. [Fork][fork] and clone the repository
2. Configure and install the dependencies: `npm install`
3. Make sure the tests pass on your machine: `npm run test`
4. Create a new branch: `git checkout -b my-branch-name`
4. Create a new branch: `git switch -c my-branch-name`
5. Make your change, add tests, and make sure the tests still pass
6. Push to your fork and [submit a pull request][pr]
7. Pat your self on the back and wait for your pull request to be reviewed and merged.

114
PR_TRIAGE_REPORT.md Normal file
View File

@@ -0,0 +1,114 @@
# Pull Request Triage Report for actions/cache
*Generated: 2026-01-29*
| PR Link | Author | Date Opened | Days Open | Category |
|---------|--------|-------------|-----------|----------|
| [#1700](https://github.com/actions/cache/pull/1700) | Copilot | 2026-01-29 | 0 | Other |
| [#1689](https://github.com/actions/cache/pull/1689) | StephenHodgson | 2025-12-13 | 47 | New feature |
| [#1683](https://github.com/actions/cache/pull/1683) | salmanmkc | 2025-12-11 | 49 | Documentation |
| [#1672](https://github.com/actions/cache/pull/1672) | alinernunes15-a11y | 2025-11-07 | 83 | Documentation |
| [#1671](https://github.com/actions/cache/pull/1671) | dulcekarma7u7-netizen | 2025-10-28 | 93 | Documentation |
| [#1654](https://github.com/actions/cache/pull/1654) | timbaverstock-bmbl | 2025-09-22 | 129 | Documentation |
| [#1639](https://github.com/actions/cache/pull/1639) | atoulme | 2025-08-08 | 174 | Documentation |
| [#1638](https://github.com/actions/cache/pull/1638) | TNGBBK | 2025-08-07 | 175 | Documentation |
| [#1605](https://github.com/actions/cache/pull/1605) | loic-bellinger | 2025-05-14 | 260 | Documentation |
| [#1604](https://github.com/actions/cache/pull/1604) | stuartleeks | 2025-05-08 | 266 | New feature |
| [#1587](https://github.com/actions/cache/pull/1587) | Yury-Fridlyand | 2025-04-06 | 298 | Documentation |
| [#1571](https://github.com/actions/cache/pull/1571) | helly25 | 2025-03-11 | 324 | New feature |
| [#1567](https://github.com/actions/cache/pull/1567) | KtorZ | 2025-03-07 | 328 | Documentation |
| [#1536](https://github.com/actions/cache/pull/1536) | KyFaSt | 2025-01-22 | 372 | Security fix |
| [#1516](https://github.com/actions/cache/pull/1516) | vorburger | 2024-12-12 | 413 | Documentation |
| [#1514](https://github.com/actions/cache/pull/1514) | lima-limon-inc | 2024-12-11 | 414 | Documentation |
| [#1493](https://github.com/actions/cache/pull/1493) | EnricoMi | 2024-11-04 | 451 | New feature |
| [#1472](https://github.com/actions/cache/pull/1472) | mustafacco7 | 2024-10-18 | 468 | Documentation |
| [#1451](https://github.com/actions/cache/pull/1451) | karlhorky | 2024-08-13 | 534 | Documentation |
| [#1439](https://github.com/actions/cache/pull/1439) | rusty-key | 2024-07-23 | 555 | Documentation |
| [#1436](https://github.com/actions/cache/pull/1436) | llakala | 2024-07-19 | 559 | New feature |
| [#1378](https://github.com/actions/cache/pull/1378) | Olegt0rr | 2024-04-16 | 653 | Other |
| [#1374](https://github.com/actions/cache/pull/1374) | itchyny | 2024-04-14 | 655 | Other |
| [#1337](https://github.com/actions/cache/pull/1337) | marco-cpd | 2024-02-23 | 706 | Bug fix |
| [#1328](https://github.com/actions/cache/pull/1328) | vorburger | 2024-02-16 | 713 | Documentation |
| [#1312](https://github.com/actions/cache/pull/1312) | Mogyuchi | 2024-01-28 | 732 | Documentation |
| [#1308](https://github.com/actions/cache/pull/1308) | PrinsFrank | 2024-01-22 | 738 | New feature |
| [#1290](https://github.com/actions/cache/pull/1290) | joseluisq | 2023-12-01 | 790 | Documentation |
| [#1283](https://github.com/actions/cache/pull/1283) | IanButterworth | 2023-11-18 | 803 | Documentation |
| [#1282](https://github.com/actions/cache/pull/1282) | jlanga | 2023-11-17 | 804 | New feature |
| [#1252](https://github.com/actions/cache/pull/1252) | Magnus167 | 2023-10-01 | 851 | Documentation |
| [#1248](https://github.com/actions/cache/pull/1248) | Fishrock123 | 2023-09-25 | 857 | Documentation |
| [#1231](https://github.com/actions/cache/pull/1231) | kbdharun | 2023-09-05 | 877 | Other |
| [#1222](https://github.com/actions/cache/pull/1222) | dsame | 2023-08-23 | 890 | Documentation |
| [#1191](https://github.com/actions/cache/pull/1191) | Yakiyo | 2023-06-15 | 959 | Documentation |
| [#1185](https://github.com/actions/cache/pull/1185) | jorendorff | 2023-06-12 | 962 | Documentation |
| [#1184](https://github.com/actions/cache/pull/1184) | byrgulle12 | 2023-06-09 | 965 | Spam candidate |
| [#1183](https://github.com/actions/cache/pull/1183) | pgrange | 2023-06-08 | 966 | Bug fix |
| [#1167](https://github.com/actions/cache/pull/1167) | tommy-gilligan | 2023-05-04 | 1001 | Documentation |
| [#1160](https://github.com/actions/cache/pull/1160) | rikhuijzer | 2023-04-24 | 1011 | Documentation |
| [#1159](https://github.com/actions/cache/pull/1159) | rodrigoalcarazdelaosa | 2023-04-23 | 1012 | Documentation |
| [#1096](https://github.com/actions/cache/pull/1096) | Lord-Kamina | 2023-01-31 | 1094 | New feature |
| [#876](https://github.com/actions/cache/pull/876) | bchen1029 | 2022-07-26 | 1283 | Bug fix |
| [#726](https://github.com/actions/cache/pull/726) | robinp | 2022-02-05 | 1454 | Documentation |
| [#717](https://github.com/actions/cache/pull/717) | jsoref | 2022-01-23 | 1467 | New feature |
| [#677](https://github.com/actions/cache/pull/677) | planetmarshall | 2021-11-14 | 1537 | Documentation |
| [#673](https://github.com/actions/cache/pull/673) | TimoRoth | 2021-11-08 | 1543 | New feature |
| [#557](https://github.com/actions/cache/pull/557) | melvyn-apryl | 2021-03-27 | 1769 | Documentation |
| [#498](https://github.com/actions/cache/pull/498) | eyal0 | 2021-01-04 | 1851 | New feature |
| [#402](https://github.com/actions/cache/pull/402) | vlsi | 2020-08-19 | 1989 | Documentation |
| [#325](https://github.com/actions/cache/pull/325) | mzabaluev | 2020-05-24 | 2076 | Documentation |
| [#268](https://github.com/actions/cache/pull/268) | FinalDes | 2020-04-21 | 2109 | Documentation |
| [#234](https://github.com/actions/cache/pull/234) | evandrocoan | 2020-03-27 | 2134 | Documentation |
## Summary by Category
| Category | Count |
|----------|-------|
| Documentation | 31 |
| New feature | 11 |
| Bug fix | 3 |
| Other | 4 |
| Security fix | 1 |
| Spam candidate | 1 |
| **Total** | **51** |
## Category Definitions
- **New feature**: PRs that add new functionality or capabilities to the cache action
- **Bug fix**: PRs that fix issues or incorrect behavior in the existing code
- **Security fix**: PRs that address security concerns or add security-related documentation
- **Documentation**: PRs that add/update README, examples, or other documentation
- **Spam candidate**: PRs with unclear purpose, incomplete/garbled content, or no meaningful changes
- **Other**: PRs that don't fit into the above categories (e.g., refactoring, dependency updates)
## Detailed Analysis Notes
### Documentation PRs (31)
Most open PRs are documentation improvements, including:
- New caching examples (pnpm, opam, Docker, ASDF, Bazel, Hugo, Dart, etc.)
- Clarifications on existing behavior (path matching, cache-hit output, key rendering)
- Updated links and references
- README improvements
### New Feature PRs (11)
Feature requests include:
- Conditional save options (`save-on-success`, `save` input)
- Force-overwrite capability for existing caches
- New outputs (cachePath, cache-primary-key)
- Compression level control
- Cache refresh/update mechanisms
### Bug Fix PRs (3)
- #1337: Adjusts storage warning message with incorrect limit
- #1183: Fixes cabal store path for Ubuntu
- #876: Fixes cache-hit value when cache not found
### Security Fix PRs (1)
- #1536: Adds recommended minimum permissions to README (by GitHub staff member)
### Spam Candidate PRs (1)
- #1184: Unclear PR with garbled Turkish text in title, renames file with no meaningful changes
### Other PRs (4)
- #1700: This current WIP triage PR
- #1378: Bumps action versions in examples
- #1374: Code refactoring (avoids re-evaluation of key input)
- #1231: Updates actions/checkout to v4 in workflows

View File

@@ -123,11 +123,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Cache Primes
id: cache-primes
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: prime-numbers
key: ${{ runner.os }}-primes
@@ -154,11 +154,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Restore cached Primes
id: cache-primes-restore
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
with:
path: |
path/to/dependencies
@@ -169,7 +169,7 @@ jobs:
.
- name: Save Primes
id: cache-primes-save
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
path: |
path/to/dependencies
@@ -224,7 +224,7 @@ A cache key can include any of the contexts, functions, literals, and operators
For example, using the [`hashFiles`](https://docs.github.com/en/actions/learn-github-actions/expressions#hashfiles) function allows you to create a new cache when dependencies change.
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
path/to/dependencies
@@ -242,7 +242,7 @@ Additionally, you can use arbitrary command output in a cache key, such as a dat
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: path/to/dependencies
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }}
@@ -262,9 +262,9 @@ Example:
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: actions/cache@v4
- uses: actions/cache@v5
id: cache
with:
path: path/to/dependencies
@@ -292,11 +292,11 @@ jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Cache Primes
id: cache-primes
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: prime-numbers
key: primes
@@ -307,7 +307,7 @@ jobs:
- name: Cache Numbers
id: cache-numbers
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: numbers
key: primes
@@ -319,11 +319,11 @@ jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Cache Primes
id: cache-primes
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: prime-numbers
key: primes

View File

@@ -1,5 +1,28 @@
# Releases
## How to prepare a release
> [!NOTE]
> Relevant for maintainers with write access only.
1. Switch to a new branch from `main`.
1. Run `npm test` to ensure all tests are passing.
1. Update the version in [`package.json`](package.json).
1. Run `npm run build` to update the compiled files.
1. Update this [`RELEASES.md`](RELEASES.md) with the new version and changes in the `## Changelog` section.
1. Run `licensed cache` to update the license report.
1. Run `licensed status` and resolve any warnings by updating the [`.licensed.yml`](.licensed.yml) file with the exceptions.
1. Commit your changes and push your branch upstream.
1. Open a pull request against `main` and get it reviewed and merged.
1. Draft a new release https://github.com/actions/cache/releases use the same version number used in `package.json`
1. Create a new tag with the version number.
1. Auto generate release notes and update them to match the changes you made in `RELEASES.md`.
1. Toggle the set as the latest release option.
1. Publish the release.
1. Navigate to https://github.com/actions/cache/actions/workflows/release-new-action-version.yml
1. There should be a workflow run queued with the same version number.
1. Approve the run to publish the new version and update the major tags for this action.
## Changelog
### 5.0.3

View File

@@ -12,7 +12,7 @@ This document lists some of the strategies (and example workflows if possible) w
jobs:
build:
runs-on: ubuntu-latest
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
key: ${{ some-metadata }}-cache
```
@@ -24,7 +24,7 @@ In your workflows, you can use different strategies to name your key depending o
One of the most common use case is to use hash for lockfile as key. This way, same cache will be restored for a lockfile until there's a change in dependencies listed in lockfile.
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
path/to/dependencies
@@ -37,7 +37,7 @@ One of the most common use case is to use hash for lockfile as key. This way, sa
If cache is not found matching the primary key, restore keys can be used to download the closest matching cache that was recently created. This ensures that the build/install step will need to additionally fetch just a handful of newer dependencies, and hence saving build time.
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
path/to/dependencies
@@ -54,7 +54,7 @@ The restore keys can be provided as a complete name, or a prefix, read more [her
In case of workflows with matrix running for multiple Operating Systems, the caches can be stored separately for each of them. This can be used in combination with hashfiles in case multiple caches are being generated per OS.
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
path/to/dependencies
@@ -73,7 +73,7 @@ Caches scoped to the particular workflow run id or run attempt can be stored and
On similar lines, commit sha can be used to create a very specialized and short lived cache.
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
path/to/dependencies
@@ -86,7 +86,7 @@ On similar lines, commit sha can be used to create a very specialized and short
Cache key can be formed by combination of more than one metadata, evaluated info.
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
path/to/dependencies
@@ -146,9 +146,9 @@ In case you are using a centralized job to create and save your cache that can b
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: actions/cache/restore@v4
- uses: actions/cache/restore@v5
id: cache
with:
path: path/to/dependencies
@@ -171,9 +171,9 @@ You can use the output of this action to exit the workflow on cache miss. This w
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: actions/cache/restore@v4
- uses: actions/cache/restore@v5
id: cache
with:
path: path/to/dependencies
@@ -194,7 +194,7 @@ steps:
If you want to avoid re-computing the cache key again in `save` action, the outputs from `restore` action can be used as input to the `save` action.
```yaml
- uses: actions/cache/restore@v4
- uses: actions/cache/restore@v5
id: restore-cache
with:
path: |
@@ -204,7 +204,7 @@ If you want to avoid re-computing the cache key again in `save` action, the outp
.
.
.
- uses: actions/cache/save@v4
- uses: actions/cache/save@v5
with:
path: |
path/to/dependencies
@@ -219,7 +219,7 @@ On the other hand, the key can also be explicitly re-computed while executing th
Let's say we have a restore step that computes key at runtime
```yaml
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
id: restore-cache
with:
key: cache-${{ hashFiles('**/lockfiles') }}
@@ -228,7 +228,7 @@ with:
Case 1: Where an user would want to reuse the key as it is
```yaml
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
```
@@ -236,7 +236,7 @@ with:
Case 2: Where the user would want to re-evaluate the key
```yaml
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
key: npm-cache-${{hashfiles(package-lock.json)}}
```
@@ -253,12 +253,12 @@ In case of multi-module projects, where the built artifact of one project needs
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build
run: ./build-parent-module.sh
- uses: actions/cache/save@v4
- uses: actions/cache/save@v5
id: cache
with:
path: path/to/dependencies
@@ -269,9 +269,9 @@ steps:
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: actions/cache/restore@v4
- uses: actions/cache/restore@v5
id: cache
with:
path: path/to/dependencies
@@ -280,7 +280,7 @@ steps:
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: ./install.sh
- name: Build
run: ./build-child-module.sh

View File

@@ -45,7 +45,7 @@
## Bun
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~/.bun/install/cache
@@ -55,7 +55,7 @@
### Windows
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~\.bun
@@ -67,7 +67,7 @@
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -76,10 +76,10 @@ Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/packa
```
Depending on the environment, huge packages might be pre-installed in the global cache folder.
With `actions/cache@v4` you can now exclude unwanted packages with [exclude pattern](https://github.com/actions/toolkit/tree/main/packages/glob#exclude-patterns)
From `actions/cache@v3` onwards, you can now exclude unwanted packages with [exclude pattern](https://github.com/actions/toolkit/tree/main/packages/glob#exclude-patterns)
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~/.nuget/packages
@@ -96,7 +96,7 @@ Or you could move the cache folder like below.
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -108,7 +108,7 @@ steps:
```yaml
- name: Cache lein project dependencies
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-clojure-${{ hashFiles('**/project.clj') }}
@@ -122,7 +122,7 @@ steps:
### POSIX
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: ~/.dub
key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.selections.json') }}
@@ -133,7 +133,7 @@ steps:
### Windows
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: ~\AppData\Local\dub
key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.selections.json') }}
@@ -146,7 +146,7 @@ steps:
### Linux
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~/.deno
@@ -157,7 +157,7 @@ steps:
### macOS
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~/.deno
@@ -168,7 +168,7 @@ steps:
### Windows
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~\.deno
@@ -179,7 +179,7 @@ steps:
## Elixir - Mix
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
deps
@@ -191,7 +191,7 @@ steps:
## Erlang - Rebar3
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v5
with:
path: |
~/.cache/rebar3
@@ -206,7 +206,7 @@ steps:
### Linux
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~/.cache/go-build
@@ -219,7 +219,7 @@ steps:
### macOS
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~/Library/Caches/go-build
@@ -232,7 +232,7 @@ steps:
### Windows
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~\AppData\Local\go-build
@@ -248,7 +248,7 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
```yaml
- name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
~/.cabal/packages
@@ -263,14 +263,14 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
### Linux or macOS
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-
- uses: actions/cache@v4
- uses: actions/cache@v5
name: Cache .stack-work
with:
path: .stack-work
@@ -282,16 +282,16 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
### Windows
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
name: Cache %APPDATA%\stack %LOCALAPPDATA%\Programs\stack
with:
path: |
~\AppData\Roaming\stack
~\AppData\Local\Programs\stack
~\AppData\Local\Programs\stack
key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-
- uses: actions/cache@v4
- uses: actions/cache@v5
name: Cache .stack-work
with:
path: .stack-work
@@ -305,7 +305,7 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
> **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@v4
- uses: actions/cache@v5
with:
path: |
~/.gradle/caches
@@ -319,7 +319,7 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
```yaml
- name: Cache local Maven repository
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -355,7 +355,7 @@ After [deprecation](https://github.blog/changelog/2022-10-11-github-actions-depr
`Get npm cache directory` step can then be used with `actions/cache` as shown below
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
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 }}
@@ -368,7 +368,7 @@ After [deprecation](https://github.blog/changelog/2022-10-11-github-actions-depr
```yaml
- name: restore lerna
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
@@ -382,7 +382,7 @@ The yarn cache directory will depend on your operating system and version of `ya
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
- uses: actions/cache@v5
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -400,7 +400,7 @@ The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/c
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
- uses: actions/cache@v5
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -415,7 +415,7 @@ Esy allows you to export built dependencies and import pre-built dependencies.
```yaml
- name: Restore Cache
id: restore-cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: _export
key: ${{ runner.os }}-esy-${{ hashFiles('esy.lock/index.json') }}
@@ -444,7 +444,7 @@ Esy allows you to export built dependencies and import pre-built dependencies.
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -465,7 +465,7 @@ Locations:
### Simple example
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -478,7 +478,7 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
### Multiple OS's in a workflow
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
@@ -486,7 +486,7 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v4
- uses: actions/cache@v5
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
@@ -494,7 +494,7 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v4
- uses: actions/cache@v5
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
@@ -520,7 +520,7 @@ jobs:
- os: windows-latest
path: ~\AppData\Local\pip\Cache
steps:
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -539,7 +539,7 @@ jobs:
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -553,11 +553,11 @@ jobs:
- name: Set up Python
# The actions/cache step below uses this id to get the exact python version
id: setup-python
uses: actions/setup-python@v2
uses: actions/setup-python@v6
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
@@ -584,7 +584,7 @@ For renv, the cache directory will vary by OS. The `RENV_PATHS_ROOT` environment
cat("##[set-output name=r-version;]", R.Version()$version.string, sep = "")
shell: Rscript {0}
- name: Restore Renv package cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ inputs.cache-version }}-${{ hashFiles('renv.lock') }}
@@ -610,7 +610,7 @@ whenever possible:
## Rust - Cargo
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
@@ -625,7 +625,7 @@ whenever possible:
```yaml
- name: Cache SBT
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
~/.ivy2/cache
@@ -636,7 +636,7 @@ whenever possible:
## Swift, Objective-C - Carthage
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: Carthage
key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
@@ -647,7 +647,7 @@ whenever possible:
## Swift, Objective-C - CocoaPods
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
@@ -658,7 +658,7 @@ whenever possible:
## Swift - Swift Package Manager
```yaml
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
@@ -673,7 +673,7 @@ env:
MINT_PATH: .mint/lib
MINT_LINK_PATH: .mint/bin
steps:
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: .mint
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
@@ -689,7 +689,7 @@ steps:
```yaml
- name: Cache Bazel
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
~/.cache/bazel
@@ -703,7 +703,7 @@ steps:
```yaml
- name: Cache Bazel
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
/private/var/tmp/_bazel_runner/

View File

@@ -35,9 +35,9 @@ If you are using separate jobs to create and save your cache(s) to be reused by
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: actions/cache/restore@v4
- uses: actions/cache/restore@v5
id: cache
with:
path: path/to/dependencies
@@ -64,12 +64,12 @@ In case of multi-module projects, where the built artifact of one project needs
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build
run: /build-parent-module.sh
- uses: actions/cache/save@v4
- uses: actions/cache/save@v5
id: cache
with:
path: path/to/dependencies
@@ -80,9 +80,9 @@ steps:
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: actions/cache/restore@v4
- uses: actions/cache/restore@v5
id: cache
with:
path: path/to/dependencies
@@ -107,9 +107,9 @@ To fail if there is no cache hit for the primary key, leave `restore-keys` empty
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: actions/cache/restore@v4
- uses: actions/cache/restore@v5
id: cache
with:
path: path/to/dependencies

View File

@@ -23,7 +23,7 @@ If you are using separate jobs for generating common artifacts and sharing them
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Dependencies
run: /install.sh
@@ -31,7 +31,7 @@ steps:
- name: Build artifacts
run: /build.sh
- uses: actions/cache/save@v4
- uses: actions/cache/save@v5
id: cache
with:
path: path/to/dependencies
@@ -47,7 +47,7 @@ Let's say we have a restore step that computes a key at runtime.
#### Restore a cache
```yaml
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
id: restore-cache
with:
key: cache-${{ hashFiles('**/lockfiles') }}
@@ -55,7 +55,7 @@ with:
#### Case 1 - Where a user would want to reuse the key as it is
```yaml
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
```
@@ -63,7 +63,7 @@ with:
#### Case 2 - Where the user would want to re-evaluate the key
```yaml
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
key: npm-cache-${{hashfiles(package-lock.json)}}
```
@@ -91,11 +91,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Restore cached Prime Numbers
id: cache-prime-numbers-restore
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
with:
key: ${{ runner.os }}-prime-numbers
path: |
@@ -107,7 +107,7 @@ jobs:
- name: Always Save Prime Numbers
id: cache-prime-numbers-save
if: always() && steps.cache-prime-numbers-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
key: ${{ steps.cache-prime-numbers-restore.outputs.cache-primary-key }}
path: |

View File

@@ -12,7 +12,7 @@ A cache today is immutable and cannot be updated. But some use cases require the
```yaml
- name: update cache on every commit
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: prime-numbers
key: primes-${{ runner.os }}-${{ github.run_id }} # Can use time based key as well
@@ -21,7 +21,7 @@ A cache today is immutable and cannot be updated. But some use cases require the
```
Please note that this will create a new cache on every run and hence will consume the cache [quota](./README.md#cache-limits).
## Use cache across feature branches
Reusing cache across feature branches is not allowed today to provide cache [isolation](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache). However if both feature branches are from the default branch, a good way to achieve this is to ensure that the default branch has a cache. This cache will then be consumable by both feature branches.