Compare commits

..

No commits in common. "main" and "v4.2.0" have entirely different histories.
main ... v4.2.0

99 changed files with 228346 additions and 295824 deletions

View File

@ -16,4 +16,4 @@ jobs:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with:
node-version: "24.x"
node-version: "20.x"

View File

@ -17,7 +17,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@ -10,31 +10,6 @@ on:
workflow_dispatch:
jobs:
validate-cached-dependency-records:
runs-on: ubuntu-latest
name: Check licenses
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1.7'
- name: Install licensed tool
run: |
cd "$RUNNER_TEMP"
curl -Lfs -o licensed.tar.gz https://github.com/licensee/licensed/archive/refs/tags/v5.0.4.tar.gz
tar -xzf licensed.tar.gz
cd licensed-5.0.4
bundle install
- name: Check cached dependency records
run: |
cd ${{ github.workspace }}
BUNDLE_GEMFILE=$RUNNER_TEMP/licensed-5.0.4/Gemfile bundle exec $RUNNER_TEMP/licensed-5.0.4/exe/licensed status
call-licensed:
name: Licensed
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main

View File

@ -2,7 +2,7 @@ name: 'Publish Immutable Action Version'
on:
release:
types: [released]
types: [published]
jobs:
publish:
@ -14,7 +14,7 @@ jobs:
steps:
- name: Checking out
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Publish
id: publish
uses: actions/publish-immutable-action@0.0.3

View File

@ -20,11 +20,11 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node.js 24.x
uses: actions/checkout@v4
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 24.x
node-version: 20.x
cache: npm
- run: npm ci
- name: Prettier Format Check
@ -43,7 +43,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Generate files in working directory
shell: bash
run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache
@ -66,7 +66,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Restore cache
uses: ./
with:
@ -96,7 +96,7 @@ jobs:
https_proxy: http://squid-proxy:3128
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Generate files
run: __tests__/create-cache-files.sh proxy test-cache
- name: Save cache
@ -119,7 +119,7 @@ jobs:
https_proxy: http://squid-proxy:3128
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Restore cache
uses: ./
with:

View File

@ -1,14 +1,6 @@
sources:
npm: true
# Force UTF-8 encoding
encoding: 'utf-8'
# Ignore problematic packages with encoding issues
ignored:
npm:
- form-data
allowed:
- apache-2.0
- bsd-2-clause

BIN
.licenses/NOTICE generated

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@azure/ms-rest-js.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@opentelemetry/api.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@protobuf-ts/plugin.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@protobuf-ts/protoc.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@types/node-fetch.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@types/node.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@types/tunnel.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/camel-case.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/combined-stream.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/delayed-stream.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/dot-object.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/form-data-2.5.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/form-data-3.0.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/form-data-4.0.0.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/fs.realpath.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/glob.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/inflight.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/inherits.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/lodash.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/lower-case.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/mime-db.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/no-case.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/node-fetch.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/once.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/pascal-case.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/path-to-regexp.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/prettier.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/sax.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/ts-poet.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tslib-1.14.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tslib-2.3.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tslib-2.5.0.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/twirp-ts.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/typescript.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/webidl-conversions.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/whatwg-url.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/wrappy.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/xmlbuilder.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/yaml.dep.yml generated Normal file

Binary file not shown.

View File

@ -17,32 +17,20 @@ See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/ac
### ⚠️ Important changes
> [!IMPORTANT]
> `actions/cache@v5` runs on the Node.js 24 runtime and requires a minimum Actions Runner version of `2.327.1`.
> If you are using self-hosted runners, ensure they are updated before upgrading.
The cache backend service has been rewritten from the ground up for improved performance and reliability. [actions/cache](https://github.com/actions/cache) now integrates with the new cache service (v2) APIs.
The new service will gradually roll out as of **February 1st, 2025**. The legacy service will also be sunset on the same date. Changes in these releases are **fully backward compatible**.
The new service will gradually roll out as of **February 1st, 2025**. The legacy service will also be sunset on the same date. Changes in these release are **fully backward compatible**.
**We are deprecating some versions of this action**. We recommend upgrading to version `v4` or `v3` as soon as possible before **February 1st, 2025.** (Upgrade instructions below).
If you are using pinned SHAs, please use the SHAs of versions `v4.2.0` or `v3.4.0`.
If you are using pinned SHAs, please use the SHAs of versions `v4.2.0` or `v3.4.0`
If you do not upgrade, all workflow runs using any of the deprecated [actions/cache](https://github.com/actions/cache) will fail.
Upgrading to the recommended versions will not break your workflows.
> **Additionally, if you are managing your own GitHub runners, you must update your runner version to `2.231.0` or newer to ensure compatibility with the new cache service.**
> Failure to update both the action version and your runner version may result in workflow failures after the migration date.
Read more about the change & access the migration guide: [reference to the announcement](https://github.com/actions/cache/discussions/1510).
### v5
* Updated to node 24
* Requires a minimum Actions Runner version of `2.327.1`
### v4
* Integrated with the new cache service (v2) APIs.
@ -78,8 +66,6 @@ Create a workflow `.yml` file in your repository's `.github/workflows` directory
If you are using this inside a container, a POSIX-compliant `tar` needs to be included and accessible from the execution path.
Note: `actions/cache@v5` runs on Node.js 24 and requires a minimum Actions Runner version of `2.327.1`.
If you are using a `self-hosted` Windows runner, `GNU tar` and `zstd` are required for [Cross-OS caching](https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cross-os-cache) to work. They are also recommended to be installed in general so the performance is on par with `hosted` Windows runners.
### Inputs
@ -349,23 +335,9 @@ There are a number of community practices/workarounds to fulfill specific requir
Please note that Windows environment variables (like `%LocalAppData%`) will NOT be expanded by this action. Instead, prefer using `~` in your paths which will expand to the HOME directory. For example, instead of `%LocalAppData%`, use `~\AppData\Local`. For a list of supported default environment variables, see the [Learn GitHub Actions: Variables](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) page.
## Note
## Contributing
Thank you for your interest in this GitHub repo, however, right now we are not taking contributions.
We continue to focus our resources on strategic areas that help our customers be successful while making developers' lives easier. While GitHub Actions remains a key part of this vision, we are allocating resources towards other areas of Actions and are not taking contributions to this repository at this time. The GitHub public roadmap is the best place to follow along for any updates on features were working on and what stage theyre in.
We are taking the following steps to better direct requests related to GitHub Actions, including:
1. We will be directing questions and support requests to our [Community Discussions area](https://github.com/orgs/community/discussions/categories/actions)
2. High Priority bugs can be reported through Community Discussions or you can report these to our support team https://support.github.com/contact/bug-report.
3. Security Issues should be handled as per our [security.md](SECURITY.md).
We will still provide security updates for this project and fix major breaking changes during this time.
You are welcome to still raise bugs in this repo.
We would love for you to contribute to `actions/cache`. Pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
## License

View File

@ -1,37 +1,5 @@
# Releases
## Changelog
### 5.0.1
- Update `@azure/storage-blob` to `^12.29.1` via `@actions/cache@5.0.1` [#1685](https://github.com/actions/cache/pull/1685)
### 5.0.0
> [!IMPORTANT]
> `actions/cache@v5` runs on the Node.js 24 runtime and requires a minimum Actions Runner version of `2.327.1`.
> If you are using self-hosted runners, ensure they are updated before upgrading.
### 4.3.0
- Bump `@actions/cache` to [v4.1.0](https://github.com/actions/toolkit/pull/2132)
### 4.2.4
- Bump `@actions/cache` to v4.0.5
### 4.2.3
- Bump `@actions/cache` to v4.0.3 (obfuscates SAS token in debug logs for cache entries)
### 4.2.2
- Bump `@actions/cache` to v4.0.2
### 4.2.1
- Bump `@actions/cache` to v4.0.1
### 4.2.0
TLDR; The cache backend service has been rewritten from the ground up for improved performance and reliability. [actions/cache](https://github.com/actions/cache) now integrates with the new cache service (v2) APIs.

View File

@ -38,7 +38,7 @@ outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'
runs:
using: 'node24'
using: 'node20'
main: 'dist/restore/index.js'
post: 'dist/save/index.js'
post-if: "success()"

View File

@ -102,7 +102,7 @@ The [GitHub Context](https://docs.github.com/en/actions/learn-github-actions/con
While setting paths for caching dependencies it is important to give correct path depending on the hosted runner you are using or whether the action is running in a container job. Assigning different `path` for save and restore will result in cache miss.
Below are GitHub hosted runner specific paths one should take care of when writing a workflow which saves/restores caches across OS.
Below are GiHub hosted runner specific paths one should take care of when writing a workflow which saves/restores caches across OS.
#### Ubuntu Paths

126290
dist/restore-only/index.js vendored

File diff suppressed because one or more lines are too long

126290
dist/restore/index.js vendored

File diff suppressed because one or more lines are too long

126290
dist/save-only/index.js vendored

File diff suppressed because one or more lines are too long

126290
dist/save/index.js vendored

File diff suppressed because one or more lines are too long

18791
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "cache",
"version": "5.0.1",
"version": "4.2.0",
"private": true,
"description": "Cache dependencies and build outputs",
"main": "dist/restore/index.js",
@ -23,32 +23,29 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "^5.0.1",
"@actions/core": "^2.0.0",
"@actions/exec": "^2.0.0",
"@actions/io": "^2.0.0"
"@actions/cache": "^4.0.0",
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/jest": "^27.5.2",
"@types/nock": "^11.1.0",
"@types/node": "^24.1.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@types/node": "^16.18.3",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@vercel/ncc": "^0.38.3",
"eslint": "^8.28.0",
"eslint-config-prettier": "^9.1.2",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^5.5.3",
"eslint-plugin-simple-import-sort": "^12.1.1",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.9.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-simple-import-sort": "^7.0.0",
"jest": "^28.1.3",
"jest-circus": "^27.5.1",
"nock": "^13.2.9",
"prettier": "^3.6.2",
"ts-jest": "^29.4.0",
"typescript": "^5.8.3"
},
"engines": {
"node": ">=24"
"prettier": "^2.8.0",
"ts-jest": "^28.0.8",
"typescript": "^4.9.3"
}
}

View File

@ -31,7 +31,7 @@ outputs:
cache-matched-key:
description: 'Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys'
runs:
using: 'node24'
using: 'node20'
main: '../dist/restore-only/index.js'
branding:
icon: 'archive'

View File

@ -79,10 +79,8 @@ To avoid saving a cache that already exists, the `cache-hit` output from a resto
The `cache-primary-key` output from the restore step should also be used to ensure
the cache key does not change during the build if it's calculated based on file contents.
Here's an example where we imagine we're calculating a lot of prime numbers and want to cache them:
```yaml
name: Always Caching Prime Numbers
name: Always Caching Primes
on: push
@ -93,23 +91,23 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Restore cached Prime Numbers
id: cache-prime-numbers-restore
- name: Restore cached Primes
id: cache-primes-restore
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-prime-numbers
key: ${{ runner.os }}-primes
path: |
path/to/dependencies
some/other/dependencies
# Intermediate workflow steps
- name: Always Save Prime Numbers
id: cache-prime-numbers-save
if: always() && steps.cache-prime-numbers-restore.outputs.cache-hit != 'true'
- name: Always Save Primes
id: cache-primes-save
if: always() && steps.cache-primes-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-prime-numbers-restore.outputs.cache-primary-key }}
key: ${{ steps.cache-primes-restore.outputs.cache-primary-key }}
path: |
path/to/dependencies
some/other/dependencies

View File

@ -16,7 +16,7 @@ inputs:
default: 'false'
required: false
runs:
using: 'node24'
using: 'node20'
main: '../dist/save-only/index.js'
branding:
icon: 'archive'

View File

@ -37,8 +37,9 @@ From `v3.2.3` cache is cross-os compatible when `enableCrossOsArchive` input is
## Force deletion of caches overriding default cache eviction policy
Caches have [branch scope restriction](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache) in place. This means that if caches for a specific branch are using a lot of storage quota, it may result into more frequently used caches from `default` branch getting thrashed. For example, if there are many pull requests happening on a repo and are creating caches, these cannot be used in default branch scope but will still occupy a lot of space till they get cleaned up by [eviction policy](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy). But sometime we want to clean them up on a faster cadence so as to ensure default branch is not thrashing.
Caches have [branch scope restriction](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache) in place. This means that if caches for a specific branch are using a lot of storage quota, it may result into more frequently used caches from `default` branch getting thrashed. For example, if there are many pull requests happening on a repo and are creating caches, these cannot be used in default branch scope but will still occupy a lot of space till they get cleaned up by [eviction policy](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy). But sometime we want to clean them up on a faster cadence so as to ensure default branch is not thrashing. In order to achieve this, [gh-actions-cache cli](https://github.com/actions/gh-actions-cache/) can be used to delete caches for specific branches.
This workflow uses `gh-actions-cache` to delete all the caches created by a branch.
<details>
<summary>Example</summary>
@ -59,23 +60,29 @@ jobs:
actions: write
contents: read
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge
echo "Fetching list of cache key"
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh cache delete $cacheKey
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
```
</details>