├── .github ├── CODEOWNERS ├── dependabot.yml └── workflows │ └── tests.yml ├── __tests__ ├── __fixtures__ │ └── helloWorld.txt ├── create-cache-files.sh ├── verify-cache-files.sh ├── stateProvider.test.ts ├── save.test.ts ├── saveOnly.test.ts ├── restoreOnly.test.ts └── downloadValidation.test.ts ├── src ├── save.ts ├── restore.ts ├── saveOnly.ts ├── restoreOnly.ts ├── constants.ts ├── stateProvider.ts ├── utils │ ├── testUtils.ts │ └── actionUtils.ts ├── restoreImpl.ts ├── saveImpl.ts └── custom │ ├── cache.ts │ └── backend.ts ├── .gitattributes ├── .prettierrc.json ├── .licensed.yml ├── .vscode └── launch.json ├── .devcontainer └── devcontainer.json ├── .eslintrc.json ├── jest.config.js ├── save ├── action.yml └── README.md ├── .licenses └── npm │ ├── tslib-2.5.0.dep.yml │ ├── minimatch.dep.yml │ ├── semver.dep.yml │ ├── @actions │ ├── exec.dep.yml │ ├── io.dep.yml │ ├── cache.dep.yml │ ├── core.dep.yml │ ├── glob.dep.yml │ └── http-client.dep.yml │ ├── uuid.dep.yml │ ├── tr46.dep.yml │ ├── function-bind.dep.yml │ ├── xml2js.dep.yml │ ├── get-proto.dep.yml │ ├── xmlbuilder.dep.yml │ ├── es-errors.dep.yml │ ├── concat-map.dep.yml │ ├── hasown.dep.yml │ ├── gopd.dep.yml │ ├── abort-controller.dep.yml │ ├── es-define-property.dep.yml │ ├── math-intrinsics.dep.yml │ ├── es-object-atoms.dep.yml │ ├── has-symbols.dep.yml │ ├── process.dep.yml │ ├── @azure │ ├── core-util.dep.yml │ ├── logger.dep.yml │ ├── core-paging.dep.yml │ ├── storage-blob.dep.yml │ ├── abort-controller.dep.yml │ ├── core-auth.dep.yml │ ├── core-lro.dep.yml │ ├── core-tracing.dep.yml │ ├── core-http.dep.yml │ └── ms-rest-js.dep.yml │ ├── event-target-shim.dep.yml │ ├── dunder-proto.dep.yml │ ├── mime-db.dep.yml │ ├── es-set-tostringtag.dep.yml │ ├── get-intrinsic.dep.yml │ ├── whatwg-url.dep.yml │ ├── call-bind-apply-helpers.dep.yml │ ├── has-tostringtag.dep.yml │ ├── safe-buffer.dep.yml │ ├── @types │ ├── node.dep.yml │ ├── tunnel.dep.yml │ └── node-fetch.dep.yml │ ├── asynckit.dep.yml │ ├── combined-stream.dep.yml │ ├── delayed-stream.dep.yml │ ├── tunnel.dep.yml │ ├── events.dep.yml │ ├── webidl-conversions.dep.yml │ ├── tslib-1.14.1.dep.yml │ ├── tslib-2.3.1.dep.yml │ ├── mime-types.dep.yml │ ├── sax.dep.yml │ ├── brace-expansion.dep.yml │ ├── balanced-match.dep.yml │ └── node-fetch.dep.yml ├── LICENSE ├── restore ├── action.yml └── README.md ├── package.json ├── .gitignore ├── action.yml ├── CONTRIBUTING.md ├── README.md ├── CODE_OF_CONDUCT.md ├── tips-and-workarounds.md ├── tsconfig.json └── RELEASES.md /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @actions/actions-cache 2 | -------------------------------------------------------------------------------- /__tests__/__fixtures__/helloWorld.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /src/save.ts: -------------------------------------------------------------------------------- 1 | import { saveRun } from "./saveImpl"; 2 | 3 | saveRun(true); 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | .licenses/** -diff linguist-generated=true 2 | * text=auto eol=lf -------------------------------------------------------------------------------- /src/restore.ts: -------------------------------------------------------------------------------- 1 | import { restoreRun } from "./restoreImpl"; 2 | 3 | restoreRun(true); 4 | -------------------------------------------------------------------------------- /src/saveOnly.ts: -------------------------------------------------------------------------------- 1 | import { saveOnlyRun } from "./saveImpl"; 2 | 3 | saveOnlyRun(true); 4 | -------------------------------------------------------------------------------- /src/restoreOnly.ts: -------------------------------------------------------------------------------- 1 | import { restoreOnlyRun } from "./restoreImpl"; 2 | 3 | restoreOnlyRun(true); 4 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 4, 4 | "useTabs": false, 5 | "semi": true, 6 | "singleQuote": false, 7 | "trailingComma": "none", 8 | "bracketSpacing": true, 9 | "arrowParens": "avoid", 10 | "parser": "typescript" 11 | } -------------------------------------------------------------------------------- /__tests__/create-cache-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Validate args 4 | prefix="$1" 5 | if [ -z "$prefix" ]; then 6 | echo "Must supply prefix argument" 7 | exit 1 8 | fi 9 | 10 | path="$2" 11 | if [ -z "$path" ]; then 12 | echo "Must supply path argument" 13 | exit 1 14 | fi 15 | 16 | mkdir -p $path 17 | echo "$prefix $GITHUB_RUN_ID" > $path/test-file.txt 18 | -------------------------------------------------------------------------------- /.licensed.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | npm: true 3 | 4 | # Force UTF-8 encoding 5 | encoding: 'utf-8' 6 | 7 | # Ignore problematic packages with encoding issues 8 | ignored: 9 | npm: 10 | - form-data 11 | 12 | allowed: 13 | - apache-2.0 14 | - bsd-2-clause 15 | - bsd-3-clause 16 | - isc 17 | - mit 18 | - cc0-1.0 19 | - unlicense 20 | - 0bsd 21 | 22 | reviewed: 23 | npm: 24 | - sax 25 | - "@protobuf-ts/plugin-framework" # Apache-2.0 26 | - "@protobuf-ts/runtime" # Apache-2.0 27 | - fs.realpath # ISC 28 | - glob # ISC 29 | - prettier # MIT 30 | - lodash # MIT -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Jest Test", 11 | "program": "${workspaceFolder}/node_modules/jest/bin/jest", 12 | "args": ["--runInBand", "--config=${workspaceFolder}/jest.config.js"], 13 | "console": "integratedTerminal", 14 | "internalConsoleOptions": "neverOpen" 15 | }, 16 | ] 17 | } -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Node.js & TypeScript", 3 | "image": "mcr.microsoft.com/devcontainers/typescript-node:16-bullseye", 4 | // Features to add to the dev container. More info: https://containers.dev/implementors/features. 5 | // "features": {}, 6 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 7 | // "forwardPorts": [], 8 | // Use 'postCreateCommand' to run commands after the container is created. 9 | "postCreateCommand": "npm install" 10 | // Configure tool-specific properties. 11 | // "customizations": {}, 12 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 13 | // "remoteUser": "root" 14 | } 15 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { "node": true, "jest": true }, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { "ecmaVersion": 2020, "sourceType": "module" }, 5 | "extends": [ 6 | "eslint:recommended", 7 | "plugin:@typescript-eslint/eslint-recommended", 8 | "plugin:@typescript-eslint/recommended", 9 | "plugin:import/errors", 10 | "plugin:import/warnings", 11 | "plugin:import/typescript", 12 | "plugin:prettier/recommended" 13 | ], 14 | "plugins": ["@typescript-eslint", "simple-import-sort", "jest"], 15 | "rules": { 16 | "import/first": "error", 17 | "import/newline-after-import": "error", 18 | "import/no-duplicates": "error", 19 | "simple-import-sort/imports": "error", 20 | "sort-imports": "off" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | groups: 13 | minor-actions-dependencies: 14 | update-types: [minor, patch] 15 | 16 | - package-ecosystem: "npm" 17 | directory: "/" 18 | schedule: 19 | interval: "daily" 20 | allow: 21 | - dependency-type: direct 22 | - dependency-type: production 23 | -------------------------------------------------------------------------------- /__tests__/verify-cache-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Validate args 4 | prefix="$1" 5 | if [ -z "$prefix" ]; then 6 | echo "Must supply prefix argument" 7 | exit 1 8 | fi 9 | 10 | path="$2" 11 | if [ -z "$path" ]; then 12 | echo "Must specify path argument" 13 | exit 1 14 | fi 15 | 16 | # Sanity check GITHUB_RUN_ID defined 17 | if [ -z "$GITHUB_RUN_ID" ]; then 18 | echo "GITHUB_RUN_ID not defined" 19 | exit 1 20 | fi 21 | 22 | # Verify file exists 23 | file="$path/test-file.txt" 24 | echo "Checking for $file" 25 | if [ ! -e $file ]; then 26 | echo "File does not exist" 27 | exit 1 28 | fi 29 | 30 | # Verify file content 31 | content="$(cat $file)" 32 | echo "File content:\n$content" 33 | if [ -z "$(echo $content | grep --fixed-strings "$prefix $GITHUB_RUN_ID")" ]; then 34 | echo "Unexpected file content" 35 | exit 1 36 | fi 37 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | require("nock").disableNetConnect(); 2 | 3 | module.exports = { 4 | clearMocks: true, 5 | moduleFileExtensions: ["js", "ts"], 6 | testEnvironment: "node", 7 | testMatch: ["**/*.test.ts"], 8 | testRunner: "jest-circus/runner", 9 | transform: { 10 | "^.+\\.ts$": "ts-jest" 11 | }, 12 | verbose: true 13 | }; 14 | 15 | const processStdoutWrite = process.stdout.write.bind(process.stdout); 16 | // eslint-disable-next-line @typescript-eslint/explicit-function-return-type 17 | process.stdout.write = (str, encoding, cb) => { 18 | // Core library will directly call process.stdout.write for commands 19 | // We don't want :: commands to be executed by the runner during tests 20 | if (!String(str).match(/^::/)) { 21 | return processStdoutWrite(str, encoding, cb); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /save/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Save a cache' 2 | description: 'Save Cache artifacts like dependencies and build outputs to improve workflow execution time' 3 | author: 'GitHub' 4 | inputs: 5 | path: 6 | description: 'A list of files, directories, and wildcard patterns to cache' 7 | required: true 8 | key: 9 | description: 'An explicit key for saving the cache' 10 | required: true 11 | upload-chunk-size: 12 | description: 'The chunk size used to split up large files during upload, in bytes' 13 | required: false 14 | enableCrossOsArchive: 15 | description: 'An optional boolean when enabled, allows windows runners to save caches that can be restored on other platforms' 16 | default: 'false' 17 | required: false 18 | runs: 19 | using: 'node20' 20 | main: '../dist/save-only/index.js' 21 | branding: 22 | icon: 'archive' 23 | color: 'gray-dark' 24 | -------------------------------------------------------------------------------- /.licenses/npm/tslib-2.5.0.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: tslib 3 | version: 2.5.0 4 | type: npm 5 | summary: Runtime library for TypeScript helper functions 6 | homepage: https://www.typescriptlang.org/ 7 | license: 0bsd 8 | licenses: 9 | - sources: LICENSE.txt 10 | text: |- 11 | Copyright (c) Microsoft Corporation. 12 | 13 | Permission to use, copy, modify, and/or distribute this software for any 14 | purpose with or without fee is hereby granted. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 17 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 18 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 19 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 20 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 21 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 22 | PERFORMANCE OF THIS SOFTWARE. 23 | notices: [] 24 | -------------------------------------------------------------------------------- /.licenses/npm/minimatch.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: minimatch 3 | version: 3.1.2 4 | type: npm 5 | summary: a glob matcher in javascript 6 | homepage: 7 | license: isc 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) Isaac Z. Schlueter and Contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any 16 | purpose with or without fee is hereby granted, provided that the above 17 | copyright notice and this permission notice appear in all copies. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 25 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | notices: [] 27 | -------------------------------------------------------------------------------- /.licenses/npm/semver.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: semver 3 | version: 6.3.1 4 | type: npm 5 | summary: The semantic version parser used by npm. 6 | homepage: 7 | license: isc 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) Isaac Z. Schlueter and Contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any 16 | purpose with or without fee is hereby granted, provided that the above 17 | copyright notice and this permission notice appear in all copies. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 25 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | notices: [] 27 | -------------------------------------------------------------------------------- /src/constants.ts: -------------------------------------------------------------------------------- 1 | export enum Inputs { 2 | Key = "key", // Input for cache, restore, save action 3 | Path = "path", // Input for cache, restore, save action 4 | RestoreKeys = "restore-keys", // Input for cache, restore action 5 | UploadChunkSize = "upload-chunk-size", // Input for cache, save action 6 | EnableCrossOsArchive = "enableCrossOsArchive", // Input for cache, restore, save action 7 | FailOnCacheMiss = "fail-on-cache-miss", // Input for cache, restore action 8 | LookupOnly = "lookup-only" // Input for cache, restore action 9 | } 10 | 11 | export enum Outputs { 12 | CacheHit = "cache-hit", // Output from cache, restore action 13 | CachePrimaryKey = "cache-primary-key", // Output from restore action 14 | CacheMatchedKey = "cache-matched-key" // Output from restore action 15 | } 16 | 17 | export enum State { 18 | CachePrimaryKey = "CACHE_KEY", 19 | CacheMatchedKey = "CACHE_RESULT" 20 | } 21 | 22 | export enum Events { 23 | Key = "GITHUB_EVENT_NAME", 24 | Push = "push", 25 | PullRequest = "pull_request" 26 | } 27 | 28 | export const RefKey = "GITHUB_REF"; 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2018 GitHub, Inc. and contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /.licenses/npm/@actions/exec.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/exec" 3 | version: 1.1.1 4 | type: npm 5 | summary: 6 | homepage: 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright 2019 GitHub 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | notices: [] 21 | -------------------------------------------------------------------------------- /.licenses/npm/uuid.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: uuid 3 | version: 8.3.2 4 | type: npm 5 | summary: RFC4122 (v1, v4, and v5) UUIDs 6 | homepage: 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2010-2020 Robert Kieffer and other contributors 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | notices: [] 21 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/io.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/io" 3 | version: 1.1.3 4 | type: npm 5 | summary: Actions io lib 6 | homepage: https://github.com/actions/toolkit/tree/main/packages/io 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright 2019 GitHub 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | notices: [] 21 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/cache.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/cache" 3 | version: 4.1.0 4 | type: npm 5 | summary: Actions cache lib 6 | homepage: https://github.com/actions/toolkit/tree/main/packages/cache 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright 2019 GitHub 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | notices: [] 21 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/core.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/core" 3 | version: 1.11.1 4 | type: npm 5 | summary: Actions core lib 6 | homepage: https://github.com/actions/toolkit/tree/main/packages/core 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright 2019 GitHub 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | notices: [] 21 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/glob.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/glob" 3 | version: 0.1.2 4 | type: npm 5 | summary: Actions glob lib 6 | homepage: https://github.com/actions/toolkit/tree/main/packages/glob 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright 2019 GitHub 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | notices: [] 21 | -------------------------------------------------------------------------------- /.licenses/npm/tr46.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: tr46 3 | version: 0.0.3 4 | type: npm 5 | summary: An implementation of the Unicode TR46 spec 6 | homepage: https://github.com/Sebmaster/tr46.js#readme 7 | license: mit 8 | licenses: 9 | - sources: Auto-generated MIT license text 10 | text: | 11 | MIT License 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | SOFTWARE. 30 | notices: [] 31 | -------------------------------------------------------------------------------- /.licenses/npm/function-bind.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: function-bind 3 | version: 1.1.2 4 | type: npm 5 | summary: Implementation of Function.prototype.bind 6 | homepage: https://github.com/Raynos/function-bind 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |+ 11 | Copyright (c) 2013 Raynos. 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in 21 | all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 | THE SOFTWARE. 30 | 31 | notices: [] 32 | ... 33 | -------------------------------------------------------------------------------- /.licenses/npm/xml2js.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: xml2js 3 | version: 0.5.0 4 | type: npm 5 | summary: Simple XML to JavaScript object converter. 6 | homepage: https://github.com/Leonidas-from-XIV/node-xml2js 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright 2010, 2011, 2012, 2013. All rights reserved. 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to 15 | deal in the Software without restriction, including without limitation the 16 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 17 | sell copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in 21 | all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 | IN THE SOFTWARE. 30 | notices: [] 31 | -------------------------------------------------------------------------------- /.licenses/npm/get-proto.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: get-proto 3 | version: 1.0.1 4 | type: npm 5 | summary: Robustly get the [[Prototype]] of an object 6 | homepage: https://github.com/ljharb/get-proto#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2025 Jordan Harband 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/xmlbuilder.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: xmlbuilder 3 | version: 11.0.1 4 | type: npm 5 | summary: An XML builder for node.js 6 | homepage: http://github.com/oozcitak/xmlbuilder-js 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: "The MIT License (MIT)\r\n\r\nCopyright (c) 2013 Ozgur Ozcitak\r\n\r\nPermission 11 | is hereby granted, free of charge, to any person obtaining a copy\r\nof this software 12 | and associated documentation files (the \"Software\"), to deal\r\nin the Software 13 | without restriction, including without limitation the rights\r\nto use, copy, 14 | modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, 15 | and to permit persons to whom the Software is\r\nfurnished to do so, subject to 16 | the following conditions:\r\n\r\nThe above copyright notice and this permission 17 | notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE 18 | SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, 19 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR 20 | A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR 21 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER 22 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION 23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n" 24 | notices: [] 25 | -------------------------------------------------------------------------------- /.licenses/npm/es-errors.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: es-errors 3 | version: 1.3.0 4 | type: npm 5 | summary: A simple cache for a few of the JS Error constructors. 6 | homepage: https://github.com/ljharb/es-errors#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2024 Jordan Harband 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/concat-map.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: concat-map 3 | version: 0.0.1 4 | type: npm 5 | summary: concatenative mapdashery 6 | homepage: https://github.com/substack/node-concat-map#readme 7 | license: other 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | This software is released under the MIT license: 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy of 14 | this software and associated documentation files (the "Software"), to deal in 15 | the Software without restriction, including without limitation the rights to 16 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 17 | the Software, and to permit persons to whom the Software is furnished to do so, 18 | subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 25 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 26 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 27 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | - sources: README.markdown 30 | text: MIT 31 | notices: [] 32 | -------------------------------------------------------------------------------- /.licenses/npm/hasown.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: hasown 3 | version: 2.0.2 4 | type: npm 5 | summary: A robust, ES3 compatible, "has own property" predicate. 6 | homepage: https://github.com/inspect-js/hasOwn#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) Jordan Harband and contributors 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/gopd.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: gopd 3 | version: 1.2.0 4 | type: npm 5 | summary: "`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation." 6 | homepage: https://github.com/ljharb/gopd#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2022 Jordan Harband 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/abort-controller.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: abort-controller 3 | version: 3.0.0 4 | type: npm 5 | summary: An implementation of WHATWG AbortController interface. 6 | homepage: https://github.com/mysticatea/abort-controller#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2017 Toru Nagashima 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/es-define-property.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: es-define-property 3 | version: 1.0.1 4 | type: npm 5 | summary: "`Object.defineProperty`, but not IE 8's broken one." 6 | homepage: https://github.com/ljharb/es-define-property#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2024 Jordan Harband 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/math-intrinsics.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: math-intrinsics 3 | version: 1.1.0 4 | type: npm 5 | summary: ES Math-related intrinsics and helpers, robustly cached. 6 | homepage: https://github.com/es-shims/math-intrinsics#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2024 ECMAScript Shims 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/es-object-atoms.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: es-object-atoms 3 | version: 1.1.1 4 | type: npm 5 | summary: 'ES Object-related atoms: Object, ToObject, RequireObjectCoercible' 6 | homepage: https://github.com/ljharb/es-object-atoms#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2024 Jordan Harband 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/has-symbols.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: has-symbols 3 | version: 1.1.0 4 | type: npm 5 | summary: Determine if the JS environment has Symbol support. Supports spec, or shams. 6 | homepage: https://github.com/ljharb/has-symbols#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2016 Jordan Harband 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/process.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: process 3 | version: 0.11.10 4 | type: npm 5 | summary: process information for node.js and browsers 6 | homepage: https://github.com/shtylman/node-process#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | (The MIT License) 12 | 13 | Copyright (c) 2013 Roman Shtylman 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining 16 | a copy of this software and associated documentation files (the 17 | 'Software'), to deal in the Software without restriction, including 18 | without limitation the rights to use, copy, modify, merge, publish, 19 | distribute, sublicense, and/or sell copies of the Software, and to 20 | permit persons to whom the Software is furnished to do so, subject to 21 | the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be 24 | included in all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 27 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 29 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 30 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 31 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 32 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/core-util.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/core-util" 3 | version: 1.2.0 4 | type: npm 5 | summary: Core library for shared utility methods 6 | homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-util/ 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2020 Microsoft 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/event-target-shim.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: event-target-shim 3 | version: 5.0.1 4 | type: npm 5 | summary: An implementation of WHATWG EventTarget interface. 6 | homepage: https://github.com/mysticatea/event-target-shim 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |+ 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2015 Toru Nagashima 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/logger.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/logger" 3 | version: 1.0.4 4 | type: npm 5 | summary: Microsoft Azure SDK for JavaScript - Logger 6 | homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger/README.md 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2020 Microsoft 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/dunder-proto.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: dunder-proto 3 | version: 1.0.1 4 | type: npm 5 | summary: If available, the `Object.prototype.__proto__` accessor and mutator, call-bound 6 | homepage: https://github.com/es-shims/dunder-proto#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2024 ECMAScript Shims 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/mime-db.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: mime-db 3 | version: 1.52.0 4 | type: npm 5 | summary: Media Type Database 6 | homepage: 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | (The MIT License) 12 | 13 | Copyright (c) 2014 Jonathan Ong 14 | Copyright (c) 2015-2022 Douglas Christopher Wilson 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining 17 | a copy of this software and associated documentation files (the 18 | 'Software'), to deal in the Software without restriction, including 19 | without limitation the rights to use, copy, modify, merge, publish, 20 | distribute, sublicense, and/or sell copies of the Software, and to 21 | permit persons to whom the Software is furnished to do so, subject to 22 | the following conditions: 23 | 24 | The above copyright notice and this permission notice shall be 25 | included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 29 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 30 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 31 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 32 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 33 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/es-set-tostringtag.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: es-set-tostringtag 3 | version: 2.1.0 4 | type: npm 5 | summary: A helper to optimistically set Symbol.toStringTag, when possible. 6 | homepage: https://github.com/es-shims/es-set-tostringtag#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2022 ECMAScript Shims 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/get-intrinsic.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: get-intrinsic 3 | version: 1.3.0 4 | type: npm 5 | summary: Get and robustly cache all JS language-level intrinsics at first require 6 | time 7 | homepage: https://github.com/ljharb/get-intrinsic#readme 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | MIT License 13 | 14 | Copyright (c) 2020 Jordan Harband 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/npm/whatwg-url.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: whatwg-url 3 | version: 5.0.0 4 | type: npm 5 | summary: An implementation of the WHATWG URL Standard's URL API and parsing machinery 6 | homepage: https://github.com/jsdom/whatwg-url#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.txt 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2015–2016 Sebastian Mayr 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/http-client.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/http-client" 3 | version: 2.1.1 4 | type: npm 5 | summary: Actions Http Client 6 | homepage: https://github.com/actions/toolkit/tree/main/packages/http-client 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Actions Http Client for Node.js 12 | 13 | Copyright (c) GitHub, Inc. 14 | 15 | All rights reserved. 16 | 17 | MIT License 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 20 | associated documentation files (the "Software"), to deal in the Software without restriction, 21 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 22 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 23 | subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 28 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 29 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 30 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 31 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/core-paging.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/core-paging" 3 | version: 1.5.0 4 | type: npm 5 | summary: Core types for paging async iterable iterators 6 | homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2020 Microsoft 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/storage-blob.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/storage-blob" 3 | version: 12.13.0 4 | type: npm 5 | summary: Microsoft Azure Storage SDK for JavaScript - Blob 6 | homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/ 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2020 Microsoft 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/call-bind-apply-helpers.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: call-bind-apply-helpers 3 | version: 1.0.2 4 | type: npm 5 | summary: Helper functions around Function call/apply/bind, for use in `call-bind` 6 | homepage: https://github.com/ljharb/call-bind-apply-helpers#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2024 Jordan Harband 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/has-tostringtag.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: has-tostringtag 3 | version: 1.0.2 4 | type: npm 5 | summary: Determine if the JS environment has `Symbol.toStringTag` support. Supports 6 | spec, or shams. 7 | homepage: https://github.com/inspect-js/has-tostringtag#readme 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | MIT License 13 | 14 | Copyright (c) 2021 Inspect JS 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/abort-controller.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/abort-controller" 3 | version: 1.1.0 4 | type: npm 5 | summary: Microsoft Azure SDK for JavaScript - Aborter 6 | homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller/README.md 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2020 Microsoft 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/safe-buffer.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: safe-buffer 3 | version: 5.2.1 4 | type: npm 5 | summary: Safer Node.js Buffer API 6 | homepage: https://github.com/feross/safe-buffer 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) Feross Aboukhadijeh 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/@types/node.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@types/node" 3 | version: 16.18.3 4 | type: npm 5 | summary: TypeScript definitions for Node.js 6 | homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |2 11 | MIT License 12 | 13 | Copyright (c) Microsoft Corporation. 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/core-auth.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/core-auth" 3 | version: 1.3.2 4 | type: npm 5 | summary: Provides low-level interfaces and helper methods for authentication in Azure 6 | SDK 7 | homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-auth/README.md 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) 2020 Microsoft 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/npm/@types/tunnel.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@types/tunnel" 3 | version: 0.0.3 4 | type: npm 5 | summary: TypeScript definitions for tunnel 6 | homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tunnel 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |2 11 | MIT License 12 | 13 | Copyright (c) Microsoft Corporation. 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/asynckit.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: asynckit 3 | version: 0.4.0 4 | type: npm 5 | summary: Minimal async jobs utility library, with streams support 6 | homepage: https://github.com/alexindigo/asynckit#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2016 Alex Indigo 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | - sources: README.md 33 | text: AsyncKit is licensed under the MIT license. 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/core-lro.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/core-lro" 3 | version: 2.5.1 4 | type: npm 5 | summary: Isomorphic client library for supporting long-running operations in node.js 6 | and browser. 7 | homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-lro/README.md 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) 2020 Microsoft 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/core-tracing.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/core-tracing" 3 | version: 1.0.0-preview.13 4 | type: npm 5 | summary: Provides low-level interfaces and helper methods for tracing in Azure SDK 6 | homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-tracing/README.md 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2020 Microsoft 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /src/stateProvider.ts: -------------------------------------------------------------------------------- 1 | import * as core from "@actions/core"; 2 | 3 | import { Outputs, State } from "./constants"; 4 | 5 | export interface IStateProvider { 6 | setState(key: string, value: string): void; 7 | getState(key: string): string; 8 | 9 | getCacheState(): string | undefined; 10 | } 11 | 12 | class StateProviderBase implements IStateProvider { 13 | getCacheState(): string | undefined { 14 | const cacheKey = this.getState(State.CacheMatchedKey); 15 | if (cacheKey) { 16 | core.debug(`Cache state/key: ${cacheKey}`); 17 | return cacheKey; 18 | } 19 | 20 | return undefined; 21 | } 22 | 23 | // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function 24 | setState = (key: string, value: string) => {}; 25 | 26 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 27 | getState = (key: string) => ""; 28 | } 29 | 30 | export class StateProvider extends StateProviderBase { 31 | setState = core.saveState; 32 | getState = core.getState; 33 | } 34 | 35 | export class NullStateProvider extends StateProviderBase { 36 | stateToOutputMap = new Map([ 37 | [State.CacheMatchedKey, Outputs.CacheMatchedKey], 38 | [State.CachePrimaryKey, Outputs.CachePrimaryKey] 39 | ]); 40 | 41 | setState = (key: string, value: string) => { 42 | core.setOutput(this.stateToOutputMap.get(key) as string, value); 43 | }; 44 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 45 | getState = (key: string) => ""; 46 | } 47 | -------------------------------------------------------------------------------- /.licenses/npm/@types/node-fetch.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@types/node-fetch" 3 | version: 2.6.2 4 | type: npm 5 | summary: TypeScript definitions for node-fetch 6 | homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |2 11 | MIT License 12 | 13 | Copyright (c) Microsoft Corporation. 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/combined-stream.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: combined-stream 3 | version: 1.0.8 4 | type: npm 5 | summary: A stream that emits multiple other streams one after another. 6 | homepage: https://github.com/felixge/node-combined-stream 7 | license: mit 8 | licenses: 9 | - sources: License 10 | text: | 11 | Copyright (c) 2011 Debuggable Limited 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in 21 | all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 | THE SOFTWARE. 30 | - sources: Readme.md 31 | text: combined-stream is licensed under the MIT license. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/delayed-stream.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: delayed-stream 3 | version: 1.0.0 4 | type: npm 5 | summary: Buffers events from a stream until you are ready to handle them. 6 | homepage: https://github.com/felixge/node-delayed-stream 7 | license: mit 8 | licenses: 9 | - sources: License 10 | text: | 11 | Copyright (c) 2011 Debuggable Limited 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in 21 | all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 | THE SOFTWARE. 30 | - sources: Readme.md 31 | text: delayed-stream is licensed under the MIT license. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/core-http.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/core-http" 3 | version: 3.0.4 4 | type: npm 5 | summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client 6 | libraries generated using AutoRest 7 | homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-http/README.md 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) 2020 Microsoft 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/npm/tunnel.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: tunnel 3 | version: 0.0.6 4 | type: npm 5 | summary: Node HTTP/HTTPS Agents for tunneling proxies 6 | homepage: https://github.com/koichik/node-tunnel/ 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2012 Koichi Kobayashi 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: Licensed under the [MIT](https://github.com/koichik/node-tunnel/blob/master/LICENSE) 34 | license. 35 | notices: [] 36 | -------------------------------------------------------------------------------- /.licenses/npm/events.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: events 3 | version: 3.3.0 4 | type: npm 5 | summary: Node's event emitter for all engines. 6 | homepage: https://github.com/Gozala/events#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT 12 | 13 | Copyright Joyent, Inc. and other Node contributors. 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a 16 | copy of this software and associated documentation files (the 17 | "Software"), to deal in the Software without restriction, including 18 | without limitation the rights to use, copy, modify, merge, publish, 19 | distribute, sublicense, and/or sell copies of the Software, and to permit 20 | persons to whom the Software is furnished to do so, subject to the 21 | following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included 24 | in all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 27 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 29 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 30 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 31 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 32 | USE OR OTHER DEALINGS IN THE SOFTWARE. 33 | - sources: Readme.md 34 | text: |- 35 | [MIT](./LICENSE) 36 | 37 | [node.js docs]: https://nodejs.org/dist/v11.13.0/docs/api/events.html 38 | notices: [] 39 | -------------------------------------------------------------------------------- /.licenses/npm/@azure/ms-rest-js.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@azure/ms-rest-js" 3 | version: 2.7.0 4 | type: npm 5 | summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client 6 | libraries generated using AutoRest 7 | homepage: https://github.com/Azure/ms-rest-js 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: |2 12 | MIT License 13 | 14 | Copyright (c) Microsoft Corporation. All rights reserved. 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE 33 | notices: [] 34 | -------------------------------------------------------------------------------- /.licenses/npm/webidl-conversions.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: webidl-conversions 3 | version: 3.0.1 4 | type: npm 5 | summary: Implements the WebIDL algorithms for converting to and from JavaScript values 6 | homepage: https://github.com/jsdom/webidl-conversions#readme 7 | license: bsd-2-clause 8 | licenses: 9 | - sources: LICENSE.md 10 | text: | 11 | # The BSD 2-Clause License 12 | 13 | Copyright (c) 2014, Domenic Denicola 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 17 | 18 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 19 | 20 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | notices: [] 24 | -------------------------------------------------------------------------------- /restore/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Restore Cache' 2 | description: 'Restore Cache artifacts like dependencies and build outputs to improve workflow execution time' 3 | author: 'GitHub' 4 | inputs: 5 | path: 6 | description: 'A list of files, directories, and wildcard patterns to restore' 7 | required: true 8 | key: 9 | description: 'An explicit key for restoring the cache' 10 | required: true 11 | restore-keys: 12 | description: 'An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case.' 13 | required: false 14 | enableCrossOsArchive: 15 | description: 'An optional boolean when enabled, allows windows runners to restore caches that were saved on other platforms' 16 | default: 'false' 17 | required: false 18 | fail-on-cache-miss: 19 | description: 'Fail the workflow if cache entry is not found' 20 | default: 'false' 21 | required: false 22 | lookup-only: 23 | description: 'Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache' 24 | default: 'false' 25 | required: false 26 | outputs: 27 | cache-hit: 28 | description: 'A boolean value to indicate an exact match was found for the primary key' 29 | cache-primary-key: 30 | description: 'A resolved cache key for which cache match was attempted' 31 | cache-matched-key: 32 | 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' 33 | runs: 34 | using: 'node20' 35 | main: '../dist/restore-only/index.js' 36 | branding: 37 | icon: 'archive' 38 | color: 'gray-dark' 39 | -------------------------------------------------------------------------------- /src/utils/testUtils.ts: -------------------------------------------------------------------------------- 1 | import { Inputs } from "../constants"; 2 | 3 | // See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67 4 | function getInputName(name: string): string { 5 | return `INPUT_${name.replace(/ /g, "_").toUpperCase()}`; 6 | } 7 | 8 | export function setInput(name: string, value: string): void { 9 | process.env[getInputName(name)] = value; 10 | } 11 | 12 | interface CacheInput { 13 | path: string; 14 | key: string; 15 | restoreKeys?: string[]; 16 | enableCrossOsArchive?: boolean; 17 | failOnCacheMiss?: boolean; 18 | lookupOnly?: boolean; 19 | } 20 | 21 | export function setInputs(input: CacheInput): void { 22 | setInput(Inputs.Path, input.path); 23 | setInput(Inputs.Key, input.key); 24 | input.restoreKeys && 25 | setInput(Inputs.RestoreKeys, input.restoreKeys.join("\n")); 26 | input.enableCrossOsArchive !== undefined && 27 | setInput( 28 | Inputs.EnableCrossOsArchive, 29 | input.enableCrossOsArchive.toString() 30 | ); 31 | input.failOnCacheMiss !== undefined && 32 | setInput(Inputs.FailOnCacheMiss, input.failOnCacheMiss.toString()); 33 | input.lookupOnly !== undefined && 34 | setInput(Inputs.LookupOnly, input.lookupOnly.toString()); 35 | } 36 | 37 | export function clearInputs(): void { 38 | delete process.env[getInputName(Inputs.Path)]; 39 | delete process.env[getInputName(Inputs.Key)]; 40 | delete process.env[getInputName(Inputs.RestoreKeys)]; 41 | delete process.env[getInputName(Inputs.UploadChunkSize)]; 42 | delete process.env[getInputName(Inputs.EnableCrossOsArchive)]; 43 | delete process.env[getInputName(Inputs.FailOnCacheMiss)]; 44 | delete process.env[getInputName(Inputs.LookupOnly)]; 45 | } 46 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cache", 3 | "version": "4.3.0", 4 | "private": true, 5 | "description": "Cache dependencies and build outputs", 6 | "main": "dist/restore/index.js", 7 | "scripts": { 8 | "build": "ncc build -o dist/restore src/restore.ts && ncc build -o dist/save src/save.ts && ncc build -o dist/restore-only src/restoreOnly.ts && ncc build -o dist/save-only src/saveOnly.ts", 9 | "test": "tsc --noEmit && jest --coverage", 10 | "lint": "eslint **/*.ts --cache", 11 | "format": "prettier --write **/*.ts", 12 | "format-check": "prettier --check **/*.ts" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/actions/cache.git" 17 | }, 18 | "keywords": [ 19 | "actions", 20 | "node", 21 | "cache" 22 | ], 23 | "author": "GitHub", 24 | "license": "MIT", 25 | "dependencies": { 26 | "@actions/cache": "^4.1.0", 27 | "@actions/core": "^1.11.1", 28 | "@actions/exec": "^1.1.1", 29 | "@actions/io": "^1.1.3", 30 | "@aws-sdk/client-s3": "^3.511.0", 31 | "@aws-sdk/lib-storage": "^3.513.0", 32 | "@aws-sdk/s3-request-presigner": "^3.513.0" 33 | }, 34 | "devDependencies": { 35 | "@types/jest": "^27.5.2", 36 | "@types/nock": "^11.1.0", 37 | "@types/node": "^16.18.3", 38 | "@typescript-eslint/eslint-plugin": "^5.45.0", 39 | "@typescript-eslint/parser": "^5.45.0", 40 | "@vercel/ncc": "^0.38.3", 41 | "eslint": "^8.28.0", 42 | "eslint-config-prettier": "^8.5.0", 43 | "eslint-plugin-import": "^2.26.0", 44 | "eslint-plugin-jest": "^26.9.0", 45 | "eslint-plugin-prettier": "^4.2.1", 46 | "eslint-plugin-simple-import-sort": "^7.0.0", 47 | "jest": "^28.1.3", 48 | "jest-circus": "^27.5.1", 49 | "nock": "^13.5.6", 50 | "prettier": "^2.8.8", 51 | "ts-jest": "^28.0.8", 52 | "typescript": "^4.9.3" 53 | } 54 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __tests__/runner/* 2 | 3 | node_modules/ 4 | lib/ 5 | 6 | # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore 7 | # Logs 8 | logs 9 | *.log 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | lerna-debug.log* 14 | 15 | # Diagnostic reports (https://nodejs.org/api/report.html) 16 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | *.lcov 30 | 31 | # nyc test coverage 32 | .nyc_output 33 | 34 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 35 | .grunt 36 | 37 | # Bower dependency directory (https://bower.io/) 38 | bower_components 39 | 40 | # node-waf configuration 41 | .lock-wscript 42 | 43 | # Compiled binary addons (https://nodejs.org/api/addons.html) 44 | build/Release 45 | 46 | # Dependency directories 47 | jspm_packages/ 48 | 49 | # TypeScript v1 declaration files 50 | typings/ 51 | 52 | # TypeScript cache 53 | *.tsbuildinfo 54 | 55 | # Optional npm cache directory 56 | .npm 57 | 58 | # Optional eslint cache 59 | .eslintcache 60 | 61 | # Optional REPL history 62 | .node_repl_history 63 | 64 | # Output of 'npm pack' 65 | *.tgz 66 | 67 | # Yarn Integrity file 68 | .yarn-integrity 69 | 70 | # dotenv environment variables file 71 | .env 72 | .env.test 73 | 74 | # parcel-bundler cache (https://parceljs.org/) 75 | .cache 76 | 77 | # next.js build output 78 | .next 79 | 80 | # nuxt.js build output 81 | .nuxt 82 | 83 | # vuepress build output 84 | .vuepress/dist 85 | 86 | # Serverless directories 87 | .serverless/ 88 | 89 | # FuseBox cache 90 | .fusebox/ 91 | 92 | # DynamoDB Local files 93 | .dynamodb/ 94 | 95 | # Text editor files 96 | .vscode/ 97 | -------------------------------------------------------------------------------- /.licenses/npm/tslib-1.14.1.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: tslib 3 | version: 1.14.1 4 | type: npm 5 | summary: Runtime library for TypeScript helper functions 6 | homepage: https://www.typescriptlang.org/ 7 | license: 0bsd 8 | licenses: 9 | - sources: LICENSE.txt 10 | text: |- 11 | Copyright (c) Microsoft Corporation. 12 | 13 | Permission to use, copy, modify, and/or distribute this software for any 14 | purpose with or without fee is hereby granted. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 17 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 18 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 19 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 20 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 21 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 22 | PERFORMANCE OF THIS SOFTWARE. 23 | notices: 24 | - sources: CopyrightNotice.txt 25 | text: "/*! *****************************************************************************\r\nCopyright 26 | (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute 27 | this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE 28 | SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD 29 | TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. 30 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR 31 | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, 32 | DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS 33 | ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS 34 | SOFTWARE.\r\n***************************************************************************** 35 | */" 36 | -------------------------------------------------------------------------------- /.licenses/npm/tslib-2.3.1.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: tslib 3 | version: 2.3.1 4 | type: npm 5 | summary: Runtime library for TypeScript helper functions 6 | homepage: https://www.typescriptlang.org/ 7 | license: 0bsd 8 | licenses: 9 | - sources: LICENSE.txt 10 | text: |- 11 | Copyright (c) Microsoft Corporation. 12 | 13 | Permission to use, copy, modify, and/or distribute this software for any 14 | purpose with or without fee is hereby granted. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 17 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 18 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 19 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 20 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 21 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 22 | PERFORMANCE OF THIS SOFTWARE. 23 | notices: 24 | - sources: CopyrightNotice.txt 25 | text: "/*! *****************************************************************************\r\nCopyright 26 | (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute 27 | this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE 28 | SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD 29 | TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. 30 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR 31 | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, 32 | DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS 33 | ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS 34 | SOFTWARE.\r\n***************************************************************************** 35 | */" 36 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Fast actions/cache for S3' 2 | description: 'Drop-in GitHub actions/cache replacement with S3 backend' 3 | author: 'RunsOn' 4 | inputs: 5 | path: 6 | description: 'A list of files, directories, and wildcard patterns to cache and restore' 7 | required: true 8 | key: 9 | description: 'An explicit key for restoring and saving the cache' 10 | required: true 11 | restore-keys: 12 | description: 'An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case.' 13 | required: false 14 | upload-chunk-size: 15 | description: 'The chunk size used to split up large files during upload, in bytes' 16 | required: false 17 | enableCrossOsArchive: 18 | description: 'An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms' 19 | default: 'false' 20 | required: false 21 | fail-on-cache-miss: 22 | description: 'Fail the workflow if cache entry is not found' 23 | default: 'false' 24 | required: false 25 | lookup-only: 26 | description: 'Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache' 27 | default: 'false' 28 | required: false 29 | save-always: 30 | description: 'Run the post step to save the cache even if another step before fails' 31 | default: 'false' 32 | required: false 33 | deprecationMessage: | 34 | save-always does not work as intended and will be removed in a future release. 35 | A separate `actions/cache/restore` step should be used instead. 36 | See https://github.com/actions/cache/tree/main/save#always-save-cache for more details. 37 | outputs: 38 | cache-hit: 39 | description: 'A boolean value to indicate an exact match was found for the primary key' 40 | runs: 41 | using: 'node20' 42 | main: 'dist/restore/index.js' 43 | post: 'dist/save/index.js' 44 | post-if: "success()" 45 | branding: 46 | icon: 'archive' 47 | color: 'gray-dark' 48 | -------------------------------------------------------------------------------- /.licenses/npm/mime-types.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: mime-types 3 | version: 2.1.35 4 | type: npm 5 | summary: The ultimate javascript content-type utility. 6 | homepage: 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | (The MIT License) 12 | 13 | Copyright (c) 2014 Jonathan Ong 14 | Copyright (c) 2015 Douglas Christopher Wilson 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining 17 | a copy of this software and associated documentation files (the 18 | 'Software'), to deal in the Software without restriction, including 19 | without limitation the rights to use, copy, modify, merge, publish, 20 | distribute, sublicense, and/or sell copies of the Software, and to 21 | permit persons to whom the Software is furnished to do so, subject to 22 | the following conditions: 23 | 24 | The above copyright notice and this permission notice shall be 25 | included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 29 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 30 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 31 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 32 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 33 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 34 | - sources: README.md 35 | text: |- 36 | [MIT](LICENSE) 37 | 38 | [ci-image]: https://badgen.net/github/checks/jshttp/mime-types/master?label=ci 39 | [ci-url]: https://github.com/jshttp/mime-types/actions/workflows/ci.yml 40 | [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-types/master 41 | [coveralls-url]: https://coveralls.io/r/jshttp/mime-types?branch=master 42 | [node-version-image]: https://badgen.net/npm/node/mime-types 43 | [node-version-url]: https://nodejs.org/en/download 44 | [npm-downloads-image]: https://badgen.net/npm/dm/mime-types 45 | [npm-url]: https://npmjs.org/package/mime-types 46 | [npm-version-image]: https://badgen.net/npm/v/mime-types 47 | notices: [] 48 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | [fork]: https://github.com/actions/cache/fork 4 | [pr]: https://github.com/actions/cache/compare 5 | [style]: https://github.com/styleguide/js 6 | [code-of-conduct]: CODE_OF_CONDUCT.md 7 | 8 | Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. 9 | 10 | Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE). 11 | 12 | Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. 13 | 14 | ## Submitting a pull request 15 | 16 | 1. [Fork][fork] and clone the repository 17 | 2. Configure and install the dependencies: `npm install` 18 | 3. Make sure the tests pass on your machine: `npm run test` 19 | 4. Create a new branch: `git checkout -b my-branch-name` 20 | 5. Make your change, add tests, and make sure the tests still pass 21 | 6. Push to your fork and [submit a pull request][pr] 22 | 7. Pat your self on the back and wait for your pull request to be reviewed and merged. 23 | 24 | Here are a few things you can do that will increase the likelihood of your pull request being accepted: 25 | 26 | - Write tests. 27 | - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. 28 | - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 29 | 30 | ## Licensed 31 | 32 | This repository uses a tool called [Licensed](https://github.com/github/licensed) to verify third party dependencies. You may need to locally install licensed and run `licensed cache` to update the dependency cache if you install or update a production dependency. If licensed cache is unable to determine the dependency, you may need to modify the cache file yourself to put the correct license. You should still verify the dependency, licensed is a tool to help, but is not a substitute for human review of dependencies. 33 | 34 | ## Resources 35 | 36 | - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) 37 | - [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) 38 | - [GitHub Help](https://help.github.com) -------------------------------------------------------------------------------- /.licenses/npm/sax.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: sax 3 | version: 1.2.4 4 | type: npm 5 | summary: An evented streaming XML parser in JavaScript 6 | homepage: https://github.com/isaacs/sax-js#readme 7 | license: other 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) Isaac Z. Schlueter and Contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any 16 | purpose with or without fee is hereby granted, provided that the above 17 | copyright notice and this permission notice appear in all copies. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 25 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | 27 | ==== 28 | 29 | `String.fromCodePoint` by Mathias Bynens used according to terms of MIT 30 | License, as follows: 31 | 32 | Copyright Mathias Bynens 33 | 34 | Permission is hereby granted, free of charge, to any person obtaining 35 | a copy of this software and associated documentation files (the 36 | "Software"), to deal in the Software without restriction, including 37 | without limitation the rights to use, copy, modify, merge, publish, 38 | distribute, sublicense, and/or sell copies of the Software, and to 39 | permit persons to whom the Software is furnished to do so, subject to 40 | the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be 43 | included in all copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 46 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 47 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 48 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 49 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 50 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 51 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 52 | notices: [] 53 | -------------------------------------------------------------------------------- /.licenses/npm/brace-expansion.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: brace-expansion 3 | version: 1.1.12 4 | type: npm 5 | summary: Brace expansion as known from sh/bash 6 | homepage: https://github.com/juliangruber/brace-expansion 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) 2013 Julian Gruber 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | - sources: README.md 33 | text: |- 34 | (MIT) 35 | 36 | Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> 37 | 38 | Permission is hereby granted, free of charge, to any person obtaining a copy of 39 | this software and associated documentation files (the "Software"), to deal in 40 | the Software without restriction, including without limitation the rights to 41 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 42 | of the Software, and to permit persons to whom the Software is furnished to do 43 | so, subject to the following conditions: 44 | 45 | The above copyright notice and this permission notice shall be included in all 46 | copies or substantial portions of the Software. 47 | 48 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 49 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 50 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 51 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 52 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 53 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 54 | SOFTWARE. 55 | notices: [] 56 | -------------------------------------------------------------------------------- /.licenses/npm/balanced-match.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: balanced-match 3 | version: 1.0.2 4 | type: npm 5 | summary: Match balanced character pairs, like "{" and "}" 6 | homepage: https://github.com/juliangruber/balanced-match 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: | 11 | (MIT) 12 | 13 | Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | - sources: README.md 33 | text: |- 34 | (MIT) 35 | 36 | Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> 37 | 38 | Permission is hereby granted, free of charge, to any person obtaining a copy of 39 | this software and associated documentation files (the "Software"), to deal in 40 | the Software without restriction, including without limitation the rights to 41 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 42 | of the Software, and to permit persons to whom the Software is furnished to do 43 | so, subject to the following conditions: 44 | 45 | The above copyright notice and this permission notice shall be included in all 46 | copies or substantial portions of the Software. 47 | 48 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 49 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 50 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 51 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 52 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 53 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 54 | SOFTWARE. 55 | notices: [] 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Shockingly faster cache action 2 | 3 | This action is a drop-in replacement for the official `actions/cache@v4` action, for use with the [RunsOn](https://runs-on.com/?ref=cache) self-hosted GitHub Action runner provider, or with your own self-hosted runner solution. 4 | 5 | ![image](https://github.com/runs-on/cache/assets/6114/e61c5b6f-aa86-48be-9e1b-baac6dce9b84) 6 | 7 | It will automatically store your caches in a dedicated RunsOn S3 bucket that lives close to your self-hosted runners, ensuring you get at least 200MiB/s download and upload throughput when using caches in your workflows. The larger the cache, the faster the speed. 8 | 9 | Also note that you no longer have any limit on the size of the cache. The bucket has a lifecycle rule to remove items older than 10 days. 10 | 11 | If no S3 bucket is provided, it will also transparently switch to the default behaviour. This means you can use this action and switch between RunsOn runners and official GitHub runners with no change. 12 | 13 | ## Usage with RunsOn 14 | 15 | If using [RunsOn](https://runs-on.com), simply replace `actions/cache@v4` with `runs-on/cache@v4`. All the official options are supported. 16 | 17 | ```diff 18 | - - uses: actions/cache@v4 19 | + - uses: runs-on/cache@v4 20 | with: 21 | ... 22 | ``` 23 | 24 | Please refer to [actions/cache](https://github.com/actions/cache) for usage. 25 | 26 | ## Usage outside RunsOn 27 | 28 | If you want to use this in your own infrastructure, setup your AWS credentials with [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials), then: 29 | 30 | ```yaml 31 | - uses: aws-actions/configure-aws-credentials@v4 32 | ... 33 | - uses: runs-on/cache@v4 34 | with: 35 | ... 36 | env: 37 | RUNS_ON_S3_BUCKET_CACHE: name-of-your-bucket 38 | ``` 39 | 40 | Be aware of S3 transfer costs if your runners are not in the same AWS region as your bucket. 41 | 42 | ## Special environment variables 43 | 44 | * `RUNS_ON_S3_BUCKET_CACHE`: if set, the action will use this bucket to store the cache. 45 | * `RUNS_ON_S3_BUCKET_ENDPOINT`: if set, the action will use this endpoint to connect to the bucket. This is useful if you are using AWS's S3 transfer acceleration or a non-AWS S3-compatible service. 46 | * `RUNS_ON_RUNNER_NAME`: when running on RunsOn, where this environment variable is non-empty, existing AWS credentials from the environment will be discarded. If you want to preserve existing environment variables, set this to the empty string `""`. 47 | * `RUNS_ON_S3_FORCE_PATH_STYLE` or `AWS_S3_FORCE_PATH_STYLE`: if one of those environment variables equals the string `"true"`, then the S3 client will be configured to force the path style. 48 | 49 | 50 | ## Action pinning 51 | 52 | Contrary to the upstream action, `v4` is a branch. When merging a stable release from upstream (e.g. v4.3.0), I will publish an equivalent tag in this repository. You can either pin to that tag, or a specific commit. 53 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - main 8 | - releases/** 9 | push: 10 | branches: 11 | - main 12 | - releases/** 13 | - fix/** 14 | - v4* 15 | 16 | jobs: 17 | # End to end save and restore 18 | test-save: 19 | runs-on: runs-on,runner=2cpu-linux-arm64 20 | strategy: 21 | matrix: 22 | part_size: [32] 23 | queue_size: [4, 8] 24 | fail-fast: false 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v3 28 | - name: Generate files in working directory 29 | shell: bash 30 | run: | 31 | __tests__/create-cache-files.sh ${{ runner.os }} test-cache 32 | dd if=/dev/urandom of=test-cache/random-1gb.bin bs=1M count=1024 33 | - name: Generate files outside working directory 34 | shell: bash 35 | run: __tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache 36 | - name: Save cache 37 | uses: ./ 38 | env: 39 | UPLOAD_PART_SIZE: ${{ matrix.part_size }} 40 | UPLOAD_QUEUE_SIZE: ${{ matrix.queue_size }} 41 | with: 42 | key: test-${{ runner.os }}-${{ github.run_id }}-${{ matrix.part_size }}-${{ matrix.queue_size }} 43 | path: | 44 | test-cache 45 | ~/test-cache 46 | test-restore: 47 | needs: test-save 48 | strategy: 49 | matrix: 50 | part_size: [8, 16] 51 | queue_size: [8, 12] 52 | fail-fast: false 53 | runs-on: runs-on,runner=2cpu-linux-arm64 54 | steps: 55 | - name: Checkout 56 | uses: actions/checkout@v3 57 | - name: Restore cache 58 | uses: ./ 59 | env: 60 | DOWNLOAD_PART_SIZE: ${{ matrix.part_size }} 61 | DOWNLOAD_QUEUE_SIZE: ${{ matrix.queue_size }} 62 | with: 63 | key: test-${{ runner.os }}-${{ github.run_id }}-${{ matrix.part_size }}-${{ matrix.queue_size }} 64 | restore-keys: | 65 | test-${{ runner.os }}-${{ github.run_id }}-${{ matrix.part_size }}- 66 | test-${{ runner.os }}-${{ github.run_id }}- 67 | path: | 68 | test-cache 69 | ~/test-cache 70 | - name: Verify cache files in working directory 71 | shell: bash 72 | run: __tests__/verify-cache-files.sh ${{ runner.os }} test-cache 73 | - name: Verify cache files outside working directory 74 | shell: bash 75 | run: __tests__/verify-cache-files.sh ${{ runner.os }} ~/test-cache 76 | 77 | test-container: 78 | runs-on: runs-on,runner=2cpu-linux-arm64 79 | container: 80 | image: ubuntu:latest 81 | steps: 82 | - name: Checkout 83 | uses: actions/checkout@v3 84 | - name: Test in container 85 | run: | 86 | __tests__/create-cache-files.sh Linux test-cache 87 | __tests__/verify-cache-files.sh Linux test-cache 88 | - name: Save cache 89 | uses: ./ 90 | with: 91 | key: test-container-${{ github.run_id }} 92 | path: test-cache -------------------------------------------------------------------------------- /.licenses/npm/node-fetch.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: node-fetch 3 | version: 2.6.7 4 | type: npm 5 | summary: A light-weight module that brings window.fetch to node.js 6 | homepage: https://github.com/bitinn/node-fetch 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: |+ 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2016 David Frank 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | 33 | - sources: README.md 34 | text: |- 35 | MIT 36 | 37 | [npm-image]: https://flat.badgen.net/npm/v/node-fetch 38 | [npm-url]: https://www.npmjs.com/package/node-fetch 39 | [travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch 40 | [travis-url]: https://travis-ci.org/bitinn/node-fetch 41 | [codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master 42 | [codecov-url]: https://codecov.io/gh/bitinn/node-fetch 43 | [install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch 44 | [install-size-url]: https://packagephobia.now.sh/result?p=node-fetch 45 | [discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square 46 | [discord-url]: https://discord.gg/Zxbndcm 47 | [opencollective-image]: https://opencollective.com/node-fetch/backers.svg 48 | [opencollective-url]: https://opencollective.com/node-fetch 49 | [whatwg-fetch]: https://fetch.spec.whatwg.org/ 50 | [response-init]: https://fetch.spec.whatwg.org/#responseinit 51 | [node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams 52 | [mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers 53 | [LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md 54 | [ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md 55 | [UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md 56 | notices: [] 57 | -------------------------------------------------------------------------------- /src/utils/actionUtils.ts: -------------------------------------------------------------------------------- 1 | import * as cache from "@actions/cache"; 2 | import * as core from "@actions/core"; 3 | 4 | import { RefKey } from "../constants"; 5 | 6 | export function isGhes(): boolean { 7 | const ghUrl = new URL( 8 | process.env["GITHUB_SERVER_URL"] || "https://github.com" 9 | ); 10 | 11 | const hostname = ghUrl.hostname.trimEnd().toUpperCase(); 12 | const isGitHubHost = hostname === "GITHUB.COM"; 13 | const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM"); 14 | const isLocalHost = hostname.endsWith(".LOCALHOST"); 15 | 16 | return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost; 17 | } 18 | 19 | export function isExactKeyMatch(key: string, cacheKey?: string): boolean { 20 | return !!( 21 | cacheKey && 22 | cacheKey.localeCompare(key, undefined, { 23 | sensitivity: "accent" 24 | }) === 0 25 | ); 26 | } 27 | 28 | export function logWarning(message: string): void { 29 | const warningPrefix = "[warning]"; 30 | core.info(`${warningPrefix}${message}`); 31 | } 32 | 33 | // Cache token authorized for all events that are tied to a ref 34 | // See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context 35 | export function isValidEvent(): boolean { 36 | return RefKey in process.env && Boolean(process.env[RefKey]); 37 | } 38 | 39 | export function getInputAsArray( 40 | name: string, 41 | options?: core.InputOptions 42 | ): string[] { 43 | return core 44 | .getInput(name, options) 45 | .split("\n") 46 | .map(s => s.replace(/^!\s+/, "!").trim()) 47 | .filter(x => x !== ""); 48 | } 49 | 50 | export function getInputAsInt( 51 | name: string, 52 | options?: core.InputOptions 53 | ): number | undefined { 54 | const value = parseInt(core.getInput(name, options)); 55 | if (isNaN(value) || value < 0) { 56 | return undefined; 57 | } 58 | return value; 59 | } 60 | 61 | export function getInputAsBool( 62 | name: string, 63 | options?: core.InputOptions 64 | ): boolean { 65 | const result = core.getInput(name, options); 66 | return result.toLowerCase() === "true"; 67 | } 68 | 69 | export function isCacheFeatureAvailable(): boolean { 70 | if (cache.isFeatureAvailable()) { 71 | return true; 72 | } 73 | 74 | if (isGhes()) { 75 | logWarning( 76 | `Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not. 77 | Otherwise please upgrade to GHES version >= 3.5 and If you are also using Github Connect, please unretire the actions/cache namespace before upgrade (see https://docs.github.com/en/enterprise-server@3.5/admin/github-actions/managing-access-to-actions-from-githubcom/enabling-automatic-access-to-githubcom-actions-using-github-connect#automatic-retirement-of-namespaces-for-actions-accessed-on-githubcom)` 78 | ); 79 | return false; 80 | } 81 | 82 | logWarning( 83 | "An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions." 84 | ); 85 | return false; 86 | } 87 | -------------------------------------------------------------------------------- /__tests__/stateProvider.test.ts: -------------------------------------------------------------------------------- 1 | import * as core from "@actions/core"; 2 | 3 | import { Events, RefKey, State } from "../src/constants"; 4 | import { 5 | IStateProvider, 6 | NullStateProvider, 7 | StateProvider 8 | } from "../src/stateProvider"; 9 | 10 | jest.mock("@actions/core"); 11 | 12 | beforeAll(() => { 13 | jest.spyOn(core, "getInput").mockImplementation((name, options) => { 14 | return jest.requireActual("@actions/core").getInput(name, options); 15 | }); 16 | 17 | jest.spyOn(core, "setOutput").mockImplementation((key, value) => { 18 | return jest.requireActual("@actions/core").setOutput(key, value); 19 | }); 20 | }); 21 | 22 | afterEach(() => { 23 | delete process.env[Events.Key]; 24 | delete process.env[RefKey]; 25 | }); 26 | 27 | test("StateProvider saves states", async () => { 28 | const states = new Map(); 29 | const getStateMock = jest 30 | .spyOn(core, "getState") 31 | .mockImplementation(key => states.get(key) || ""); 32 | 33 | const saveStateMock = jest 34 | .spyOn(core, "saveState") 35 | .mockImplementation((key, value) => { 36 | states.set(key, value); 37 | }); 38 | 39 | const setOutputMock = jest 40 | .spyOn(core, "setOutput") 41 | .mockImplementation((key, value) => { 42 | return jest.requireActual("@actions/core").setOutput(key, value); 43 | }); 44 | 45 | const cacheMatchedKey = "node-cache"; 46 | 47 | const stateProvider: IStateProvider = new StateProvider(); 48 | stateProvider.setState("stateKey", "stateValue"); 49 | stateProvider.setState(State.CacheMatchedKey, cacheMatchedKey); 50 | const stateValue = stateProvider.getState("stateKey"); 51 | const cacheStateValue = stateProvider.getCacheState(); 52 | 53 | expect(stateValue).toBe("stateValue"); 54 | expect(cacheStateValue).toBe(cacheMatchedKey); 55 | expect(getStateMock).toHaveBeenCalledTimes(2); 56 | expect(saveStateMock).toHaveBeenCalledTimes(2); 57 | expect(setOutputMock).toHaveBeenCalledTimes(0); 58 | }); 59 | 60 | test("NullStateProvider saves outputs", async () => { 61 | const getStateMock = jest 62 | .spyOn(core, "getState") 63 | .mockImplementation(name => 64 | jest.requireActual("@actions/core").getState(name) 65 | ); 66 | 67 | const setOutputMock = jest 68 | .spyOn(core, "setOutput") 69 | .mockImplementation((key, value) => { 70 | return jest.requireActual("@actions/core").setOutput(key, value); 71 | }); 72 | 73 | const saveStateMock = jest 74 | .spyOn(core, "saveState") 75 | .mockImplementation((key, value) => { 76 | return jest.requireActual("@actions/core").saveState(key, value); 77 | }); 78 | 79 | const cacheMatchedKey = "node-cache"; 80 | const nullStateProvider: IStateProvider = new NullStateProvider(); 81 | nullStateProvider.setState(State.CacheMatchedKey, "outputValue"); 82 | nullStateProvider.setState(State.CachePrimaryKey, cacheMatchedKey); 83 | nullStateProvider.getState("outputKey"); 84 | nullStateProvider.getCacheState(); 85 | 86 | expect(getStateMock).toHaveBeenCalledTimes(0); 87 | expect(setOutputMock).toHaveBeenCalledTimes(2); 88 | expect(saveStateMock).toHaveBeenCalledTimes(0); 89 | }); 90 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to make participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies within all project spaces, and it also applies when 49 | an individual is representing the project or its community in public spaces. 50 | Examples of representing a project or community include using an official 51 | project e-mail address, posting via an official social media account, or acting 52 | as an appointed representative at an online or offline event. Representation of 53 | a project may be further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at opensource+actions/cache@github.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /__tests__/save.test.ts: -------------------------------------------------------------------------------- 1 | import * as cache from "@actions/cache"; 2 | import * as core from "@actions/core"; 3 | 4 | import { Events, Inputs, RefKey } from "../src/constants"; 5 | import { saveRun } from "../src/saveImpl"; 6 | import * as actionUtils from "../src/utils/actionUtils"; 7 | import * as testUtils from "../src/utils/testUtils"; 8 | 9 | jest.mock("@actions/core"); 10 | jest.mock("@actions/cache"); 11 | jest.mock("../src/utils/actionUtils"); 12 | 13 | beforeAll(() => { 14 | jest.spyOn(core, "getInput").mockImplementation((name, options) => { 15 | return jest.requireActual("@actions/core").getInput(name, options); 16 | }); 17 | 18 | jest.spyOn(core, "getState").mockImplementation(name => { 19 | return jest.requireActual("@actions/core").getState(name); 20 | }); 21 | 22 | jest.spyOn(actionUtils, "getInputAsArray").mockImplementation( 23 | (name, options) => { 24 | return jest 25 | .requireActual("../src/utils/actionUtils") 26 | .getInputAsArray(name, options); 27 | } 28 | ); 29 | 30 | jest.spyOn(actionUtils, "getInputAsInt").mockImplementation( 31 | (name, options) => { 32 | return jest 33 | .requireActual("../src/utils/actionUtils") 34 | .getInputAsInt(name, options); 35 | } 36 | ); 37 | 38 | jest.spyOn(actionUtils, "getInputAsBool").mockImplementation( 39 | (name, options) => { 40 | return jest 41 | .requireActual("../src/utils/actionUtils") 42 | .getInputAsBool(name, options); 43 | } 44 | ); 45 | 46 | jest.spyOn(actionUtils, "isExactKeyMatch").mockImplementation( 47 | (key, cacheResult) => { 48 | return jest 49 | .requireActual("../src/utils/actionUtils") 50 | .isExactKeyMatch(key, cacheResult); 51 | } 52 | ); 53 | 54 | jest.spyOn(actionUtils, "isValidEvent").mockImplementation(() => { 55 | const actualUtils = jest.requireActual("../src/utils/actionUtils"); 56 | return actualUtils.isValidEvent(); 57 | }); 58 | }); 59 | 60 | beforeEach(() => { 61 | process.env[Events.Key] = Events.Push; 62 | process.env[RefKey] = "refs/heads/feature-branch"; 63 | 64 | jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); 65 | jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation( 66 | () => true 67 | ); 68 | }); 69 | 70 | afterEach(() => { 71 | testUtils.clearInputs(); 72 | delete process.env[Events.Key]; 73 | delete process.env[RefKey]; 74 | }); 75 | 76 | test("save with valid inputs uploads a cache", async () => { 77 | const failedMock = jest.spyOn(core, "setFailed"); 78 | 79 | const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; 80 | const savedCacheKey = "Linux-node-"; 81 | 82 | jest.spyOn(core, "getState") 83 | // Cache Entry State 84 | .mockImplementationOnce(() => { 85 | return primaryKey; 86 | }) 87 | // Cache Key State 88 | .mockImplementationOnce(() => { 89 | return savedCacheKey; 90 | }); 91 | 92 | const inputPath = "node_modules"; 93 | testUtils.setInput(Inputs.Path, inputPath); 94 | testUtils.setInput(Inputs.UploadChunkSize, "4000000"); 95 | 96 | const cacheId = 4; 97 | const saveCacheMock = jest 98 | .spyOn(cache, "saveCache") 99 | .mockImplementationOnce(() => { 100 | return Promise.resolve(cacheId); 101 | }); 102 | 103 | await saveRun(); 104 | 105 | expect(saveCacheMock).toHaveBeenCalledTimes(1); 106 | expect(saveCacheMock).toHaveBeenCalledWith( 107 | [inputPath], 108 | primaryKey, 109 | { 110 | uploadChunkSize: 4000000 111 | }, 112 | false 113 | ); 114 | 115 | expect(failedMock).toHaveBeenCalledTimes(0); 116 | }); 117 | -------------------------------------------------------------------------------- /save/README.md: -------------------------------------------------------------------------------- 1 | # Save action 2 | 3 | The save action saves a cache. It works similarly to the `cache` action except that it doesn't first do a restore. This action provides granular ability to save a cache without having to restore it, or to do a save at any stage of the workflow job -- not only in post phase. 4 | 5 | ## Documentation 6 | 7 | ### Inputs 8 | 9 | * `key` - An explicit key for a cache entry. See [creating a cache key](../README.md#creating-a-cache-key). 10 | * `path` - A list of files, directories, and wildcard patterns to cache. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns. 11 | * `upload-chunk-size` - The chunk size used to split up large files during upload, in bytes 12 | 13 | ### Outputs 14 | 15 | This action has no outputs. 16 | 17 | ## Use cases 18 | 19 | 20 | ### Only save cache 21 | 22 | If you are using separate jobs for generating common artifacts and sharing them across jobs, this action will take care of your cache saving needs. 23 | 24 | ```yaml 25 | steps: 26 | - uses: actions/checkout@v4 27 | 28 | - name: Install Dependencies 29 | run: /install.sh 30 | 31 | - name: Build artifacts 32 | run: /build.sh 33 | 34 | - uses: actions/cache/save@v4 35 | id: cache 36 | with: 37 | path: path/to/dependencies 38 | key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} 39 | ``` 40 | 41 | ### Re-evaluate cache key while saving 42 | 43 | With this save action, the key can now be re-evaluated while executing the action. This helps in cases where lockfiles are generated during the build. 44 | 45 | Let's say we have a restore step that computes a key at runtime. 46 | 47 | #### Restore a cache 48 | 49 | ```yaml 50 | uses: actions/cache/restore@v4 51 | id: restore-cache 52 | with: 53 | key: cache-${{ hashFiles('**/lockfiles') }} 54 | ``` 55 | 56 | #### Case 1 - Where a user would want to reuse the key as it is 57 | ```yaml 58 | uses: actions/cache/save@v4 59 | with: 60 | key: ${{ steps.restore-cache.outputs.cache-primary-key }} 61 | ``` 62 | 63 | #### Case 2 - Where the user would want to re-evaluate the key 64 | 65 | ```yaml 66 | uses: actions/cache/save@v4 67 | with: 68 | key: npm-cache-${{hashfiles(package-lock.json)}} 69 | ``` 70 | 71 | ### Always save cache 72 | 73 | There are instances where some flaky test cases would fail the entire workflow and users would get frustrated because the builds would run for hours and the cache couldn't be saved as the workflow failed in between. 74 | For such use-cases, users now have the ability to use the `actions/cache/save` action to save the cache by using an [`always()`](https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/expressions#always) condition. 75 | This way the cache will always be saved if generated, or a warning will be generated that nothing is found on the cache path. Users can also use the `if` condition to only execute the `actions/cache/save` action depending on the output of previous steps. This way they get more control of when to save the cache. 76 | 77 | To avoid saving a cache that already exists, the `cache-hit` output from a restore step should be checked. 78 | 79 | The `cache-primary-key` output from the restore step should also be used to ensure 80 | the cache key does not change during the build if it's calculated based on file contents. 81 | 82 | Here's an example where we imagine we're calculating a lot of prime numbers and want to cache them: 83 | 84 | ```yaml 85 | name: Always Caching Prime Numbers 86 | 87 | on: push 88 | 89 | jobs: 90 | build: 91 | runs-on: ubuntu-latest 92 | 93 | steps: 94 | - uses: actions/checkout@v4 95 | 96 | - name: Restore cached Prime Numbers 97 | id: cache-prime-numbers-restore 98 | uses: actions/cache/restore@v4 99 | with: 100 | key: ${{ runner.os }}-prime-numbers 101 | path: | 102 | path/to/dependencies 103 | some/other/dependencies 104 | 105 | # Intermediate workflow steps 106 | 107 | - name: Always Save Prime Numbers 108 | id: cache-prime-numbers-save 109 | if: always() && steps.cache-prime-numbers-restore.outputs.cache-hit != 'true' 110 | uses: actions/cache/save@v4 111 | with: 112 | key: ${{ steps.cache-prime-numbers-restore.outputs.cache-primary-key }} 113 | path: | 114 | path/to/dependencies 115 | some/other/dependencies 116 | ``` 117 | -------------------------------------------------------------------------------- /__tests__/saveOnly.test.ts: -------------------------------------------------------------------------------- 1 | import * as cache from "@actions/cache"; 2 | import * as core from "@actions/core"; 3 | 4 | import { Events, Inputs, RefKey } from "../src/constants"; 5 | import { saveOnlyRun } from "../src/saveImpl"; 6 | import * as actionUtils from "../src/utils/actionUtils"; 7 | import * as testUtils from "../src/utils/testUtils"; 8 | 9 | jest.mock("@actions/core"); 10 | jest.mock("@actions/cache"); 11 | jest.mock("../src/utils/actionUtils"); 12 | 13 | beforeAll(() => { 14 | jest.spyOn(core, "getInput").mockImplementation((name, options) => { 15 | return jest.requireActual("@actions/core").getInput(name, options); 16 | }); 17 | 18 | jest.spyOn(core, "setOutput").mockImplementation((key, value) => { 19 | return jest.requireActual("@actions/core").getInput(key, value); 20 | }); 21 | 22 | jest.spyOn(actionUtils, "getInputAsArray").mockImplementation( 23 | (name, options) => { 24 | return jest 25 | .requireActual("../src/utils/actionUtils") 26 | .getInputAsArray(name, options); 27 | } 28 | ); 29 | 30 | jest.spyOn(actionUtils, "getInputAsInt").mockImplementation( 31 | (name, options) => { 32 | return jest 33 | .requireActual("../src/utils/actionUtils") 34 | .getInputAsInt(name, options); 35 | } 36 | ); 37 | 38 | jest.spyOn(actionUtils, "getInputAsBool").mockImplementation( 39 | (name, options) => { 40 | return jest 41 | .requireActual("../src/utils/actionUtils") 42 | .getInputAsBool(name, options); 43 | } 44 | ); 45 | 46 | jest.spyOn(actionUtils, "isExactKeyMatch").mockImplementation( 47 | (key, cacheResult) => { 48 | return jest 49 | .requireActual("../src/utils/actionUtils") 50 | .isExactKeyMatch(key, cacheResult); 51 | } 52 | ); 53 | 54 | jest.spyOn(actionUtils, "isValidEvent").mockImplementation(() => { 55 | const actualUtils = jest.requireActual("../src/utils/actionUtils"); 56 | return actualUtils.isValidEvent(); 57 | }); 58 | }); 59 | 60 | beforeEach(() => { 61 | process.env[Events.Key] = Events.Push; 62 | process.env[RefKey] = "refs/heads/feature-branch"; 63 | 64 | jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); 65 | jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation( 66 | () => true 67 | ); 68 | }); 69 | 70 | afterEach(() => { 71 | testUtils.clearInputs(); 72 | delete process.env[Events.Key]; 73 | delete process.env[RefKey]; 74 | }); 75 | 76 | test("save with valid inputs uploads a cache", async () => { 77 | const failedMock = jest.spyOn(core, "setFailed"); 78 | 79 | const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; 80 | 81 | const inputPath = "node_modules"; 82 | testUtils.setInput(Inputs.Key, primaryKey); 83 | testUtils.setInput(Inputs.Path, inputPath); 84 | testUtils.setInput(Inputs.UploadChunkSize, "4000000"); 85 | 86 | const cacheId = 4; 87 | const saveCacheMock = jest 88 | .spyOn(cache, "saveCache") 89 | .mockImplementationOnce(() => { 90 | return Promise.resolve(cacheId); 91 | }); 92 | 93 | await saveOnlyRun(); 94 | 95 | expect(saveCacheMock).toHaveBeenCalledTimes(1); 96 | expect(saveCacheMock).toHaveBeenCalledWith( 97 | [inputPath], 98 | primaryKey, 99 | { 100 | uploadChunkSize: 4000000 101 | }, 102 | false 103 | ); 104 | 105 | expect(failedMock).toHaveBeenCalledTimes(0); 106 | }); 107 | 108 | test("save failing logs the warning message", async () => { 109 | const warningMock = jest.spyOn(core, "warning"); 110 | 111 | const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; 112 | 113 | const inputPath = "node_modules"; 114 | testUtils.setInput(Inputs.Key, primaryKey); 115 | testUtils.setInput(Inputs.Path, inputPath); 116 | testUtils.setInput(Inputs.UploadChunkSize, "4000000"); 117 | 118 | const cacheId = -1; 119 | const saveCacheMock = jest 120 | .spyOn(cache, "saveCache") 121 | .mockImplementationOnce(() => { 122 | return Promise.resolve(cacheId); 123 | }); 124 | 125 | await saveOnlyRun(); 126 | 127 | expect(saveCacheMock).toHaveBeenCalledTimes(1); 128 | expect(saveCacheMock).toHaveBeenCalledWith( 129 | [inputPath], 130 | primaryKey, 131 | { 132 | uploadChunkSize: 4000000 133 | }, 134 | false 135 | ); 136 | 137 | expect(warningMock).toHaveBeenCalledTimes(1); 138 | expect(warningMock).toHaveBeenCalledWith("Cache save failed."); 139 | }); 140 | -------------------------------------------------------------------------------- /src/restoreImpl.ts: -------------------------------------------------------------------------------- 1 | import * as cache from "@actions/cache"; 2 | import * as core from "@actions/core"; 3 | 4 | import { Events, Inputs, Outputs, State } from "./constants"; 5 | import * as custom from "./custom/cache"; 6 | import { 7 | IStateProvider, 8 | NullStateProvider, 9 | StateProvider 10 | } from "./stateProvider"; 11 | import * as utils from "./utils/actionUtils"; 12 | 13 | const canSaveToS3 = process.env["RUNS_ON_S3_BUCKET_CACHE"] !== undefined; 14 | 15 | export async function restoreImpl( 16 | stateProvider: IStateProvider, 17 | earlyExit?: boolean | undefined 18 | ): Promise { 19 | try { 20 | if (!canSaveToS3 && !utils.isCacheFeatureAvailable()) { 21 | core.setOutput(Outputs.CacheHit, "false"); 22 | return; 23 | } 24 | 25 | // Validate inputs, this can cause task failure 26 | if (!utils.isValidEvent()) { 27 | utils.logWarning( 28 | `Event Validation Error: The event type ${ 29 | process.env[Events.Key] 30 | } is not supported because it's not tied to a branch or tag ref.` 31 | ); 32 | return; 33 | } 34 | 35 | const primaryKey = core.getInput(Inputs.Key, { required: true }); 36 | stateProvider.setState(State.CachePrimaryKey, primaryKey); 37 | 38 | const restoreKeys = utils.getInputAsArray(Inputs.RestoreKeys); 39 | const cachePaths = utils.getInputAsArray(Inputs.Path, { 40 | required: true 41 | }); 42 | const enableCrossOsArchive = utils.getInputAsBool( 43 | Inputs.EnableCrossOsArchive 44 | ); 45 | const failOnCacheMiss = utils.getInputAsBool(Inputs.FailOnCacheMiss); 46 | const lookupOnly = utils.getInputAsBool(Inputs.LookupOnly); 47 | 48 | let cacheKey: string | undefined; 49 | 50 | if (canSaveToS3) { 51 | core.info( 52 | "The cache action detected a local S3 bucket cache. Using it." 53 | ); 54 | cacheKey = await custom.restoreCache( 55 | cachePaths, 56 | primaryKey, 57 | restoreKeys, 58 | { lookupOnly: lookupOnly } 59 | ); 60 | } else { 61 | cacheKey = await cache.restoreCache( 62 | cachePaths, 63 | primaryKey, 64 | restoreKeys, 65 | { lookupOnly: lookupOnly }, 66 | enableCrossOsArchive 67 | ); 68 | } 69 | 70 | if (!cacheKey) { 71 | // `cache-hit` is intentionally not set to `false` here to preserve existing behavior 72 | // See https://github.com/actions/cache/issues/1466 73 | 74 | if (failOnCacheMiss) { 75 | throw new Error( 76 | `Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}` 77 | ); 78 | } 79 | core.info( 80 | `Cache not found for input keys: ${[ 81 | primaryKey, 82 | ...restoreKeys 83 | ].join(", ")}` 84 | ); 85 | return; 86 | } 87 | 88 | // Store the matched cache key in states 89 | stateProvider.setState(State.CacheMatchedKey, cacheKey); 90 | 91 | const isExactKeyMatch = utils.isExactKeyMatch( 92 | core.getInput(Inputs.Key, { required: true }), 93 | cacheKey 94 | ); 95 | 96 | core.setOutput(Outputs.CacheHit, isExactKeyMatch.toString()); 97 | if (lookupOnly) { 98 | core.info(`Cache found and can be restored from key: ${cacheKey}`); 99 | } else { 100 | core.info(`Cache restored from key: ${cacheKey}`); 101 | } 102 | 103 | return cacheKey; 104 | } catch (error: unknown) { 105 | core.setFailed((error as Error).message); 106 | if (earlyExit) { 107 | process.exit(1); 108 | } 109 | } 110 | } 111 | 112 | async function run( 113 | stateProvider: IStateProvider, 114 | earlyExit: boolean | undefined 115 | ): Promise { 116 | await restoreImpl(stateProvider, earlyExit); 117 | 118 | // node will stay alive if any promises are not resolved, 119 | // which is a possibility if HTTP requests are dangling 120 | // due to retries or timeouts. We know that if we got here 121 | // that all promises that we care about have successfully 122 | // resolved, so simply exit with success. 123 | if (earlyExit) { 124 | process.exit(0); 125 | } 126 | } 127 | 128 | export async function restoreOnlyRun( 129 | earlyExit?: boolean | undefined 130 | ): Promise { 131 | await run(new NullStateProvider(), earlyExit); 132 | } 133 | 134 | export async function restoreRun( 135 | earlyExit?: boolean | undefined 136 | ): Promise { 137 | await run(new StateProvider(), earlyExit); 138 | } 139 | -------------------------------------------------------------------------------- /tips-and-workarounds.md: -------------------------------------------------------------------------------- 1 | # Tips and workarounds 2 | 3 | ## Cache segment restore timeout 4 | 5 | A cache gets downloaded in multiple segments of fixed sizes (`1GB` for a `32-bit` runner and `2GB` for a `64-bit` runner). Sometimes, a segment download gets stuck which causes the workflow job to be stuck forever and fail. Version `v3.0.8` of `actions/cache` introduces a segment download timeout. The segment download timeout will allow the segment download to get aborted and hence allow the job to proceed with a cache miss. 6 | 7 | Default value of this timeout is 10 minutes and can be customized by specifying an [environment variable](https://docs.github.com/en/actions/learn-github-actions/environment-variables) named `SEGMENT_DOWNLOAD_TIMEOUT_MINS` with timeout value in minutes. 8 | 9 | ## Update a cache 10 | 11 | A cache today is immutable and cannot be updated. But some use cases require the cache to be saved even though there was a "hit" during restore. To do so, use a `key` which is unique for every run and use `restore-keys` to restore the nearest cache. For example: 12 | 13 | ```yaml 14 | - name: update cache on every commit 15 | uses: actions/cache@v4 16 | with: 17 | path: prime-numbers 18 | key: primes-${{ runner.os }}-${{ github.run_id }} # Can use time based key as well 19 | restore-keys: | 20 | primes-${{ runner.os }} 21 | ``` 22 | 23 | Please note that this will create a new cache on every run and hence will consume the cache [quota](./README.md#cache-limits). 24 | 25 | ## Use cache across feature branches 26 | 27 | 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. 28 | 29 | ## Cross OS cache 30 | 31 | From `v3.2.3` cache is cross-os compatible when `enableCrossOsArchive` input is passed as true. This means that a cache created on `ubuntu-latest` or `mac-latest` can be used by `windows-latest` and vice versa, provided the workflow which runs on `windows-latest` have input `enableCrossOsArchive` as true. This is useful to cache dependencies which are independent of the runner platform. This will help reduce the consumption of the cache quota and help build for multiple platforms from the same cache. Things to keep in mind while using this feature: 32 | 33 | - Only cache files that are compatible across OSs. 34 | - Caching symlinks might cause issues while restoring them as they behave differently on different OSs. 35 | - Be mindful when caching files from outside your github workspace directory as the directory is located at different places across OS. 36 | - Avoid using directory pointers such as `${{ github.workspace }}` or `~` (home) which eventually evaluate to an absolute path that does not match across OSs. 37 | 38 | ## Force deletion of caches overriding default cache eviction policy 39 | 40 | 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. 41 | 42 |
43 | Example 44 | 45 | ```yaml 46 | name: cleanup caches by a branch 47 | on: 48 | pull_request: 49 | types: 50 | - closed 51 | workflow_dispatch: 52 | 53 | jobs: 54 | cleanup: 55 | runs-on: ubuntu-latest 56 | permissions: 57 | # `actions:write` permission is required to delete caches 58 | # See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id 59 | actions: write 60 | contents: read 61 | steps: 62 | - name: Cleanup 63 | run: | 64 | echo "Fetching list of cache key" 65 | cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id') 66 | 67 | ## Setting this to not fail the workflow while deleting cache keys. 68 | set +e 69 | echo "Deleting caches..." 70 | for cacheKey in $cacheKeysForPR 71 | do 72 | gh cache delete $cacheKey 73 | done 74 | echo "Done" 75 | env: 76 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 77 | GH_REPO: ${{ github.repository }} 78 | BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge 79 | ``` 80 | 81 |
82 | -------------------------------------------------------------------------------- /src/saveImpl.ts: -------------------------------------------------------------------------------- 1 | import * as cache from "@actions/cache"; 2 | import * as core from "@actions/core"; 3 | 4 | import { Events, Inputs, State } from "./constants"; 5 | import * as custom from "./custom/cache"; 6 | import { 7 | IStateProvider, 8 | NullStateProvider, 9 | StateProvider 10 | } from "./stateProvider"; 11 | import * as utils from "./utils/actionUtils"; 12 | 13 | const canSaveToS3 = process.env["RUNS_ON_S3_BUCKET_CACHE"] !== undefined; 14 | 15 | // Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in 16 | // @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to 17 | // throw an uncaught exception. Instead of failing this action, just warn. 18 | process.on("uncaughtException", e => utils.logWarning(e.message)); 19 | 20 | export async function saveImpl( 21 | stateProvider: IStateProvider 22 | ): Promise { 23 | let cacheId = -1; 24 | try { 25 | if (!canSaveToS3 && !utils.isCacheFeatureAvailable()) { 26 | return; 27 | } 28 | 29 | if (!utils.isValidEvent()) { 30 | utils.logWarning( 31 | `Event Validation Error: The event type ${ 32 | process.env[Events.Key] 33 | } is not supported because it's not tied to a branch or tag ref.` 34 | ); 35 | return; 36 | } 37 | 38 | // If restore has stored a primary key in state, reuse that 39 | // Else re-evaluate from inputs 40 | const primaryKey = 41 | stateProvider.getState(State.CachePrimaryKey) || 42 | core.getInput(Inputs.Key); 43 | 44 | if (!primaryKey) { 45 | utils.logWarning(`Key is not specified.`); 46 | return; 47 | } 48 | 49 | // If matched restore key is same as primary key, then do not save cache 50 | // NO-OP in case of SaveOnly action 51 | const restoredKey = stateProvider.getCacheState(); 52 | 53 | if (utils.isExactKeyMatch(primaryKey, restoredKey)) { 54 | core.info( 55 | `Cache hit occurred on the primary key ${primaryKey}, not saving cache.` 56 | ); 57 | return; 58 | } 59 | 60 | const cachePaths = utils.getInputAsArray(Inputs.Path, { 61 | required: true 62 | }); 63 | 64 | const enableCrossOsArchive = utils.getInputAsBool( 65 | Inputs.EnableCrossOsArchive 66 | ); 67 | 68 | if (canSaveToS3) { 69 | core.info( 70 | "The cache action detected a local S3 bucket cache. Using it." 71 | ); 72 | 73 | cacheId = await custom.saveCache( 74 | cachePaths, 75 | primaryKey, 76 | { 77 | uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize) 78 | }, 79 | enableCrossOsArchive 80 | ); 81 | } else { 82 | cacheId = await cache.saveCache( 83 | cachePaths, 84 | primaryKey, 85 | { 86 | uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize) 87 | }, 88 | enableCrossOsArchive 89 | ); 90 | } 91 | 92 | if (cacheId != -1) { 93 | core.info(`Cache saved with key: ${primaryKey}`); 94 | } 95 | } catch (error: unknown) { 96 | utils.logWarning((error as Error).message); 97 | } 98 | return cacheId; 99 | } 100 | 101 | export async function saveOnlyRun( 102 | earlyExit?: boolean | undefined 103 | ): Promise { 104 | try { 105 | const cacheId = await saveImpl(new NullStateProvider()); 106 | if (cacheId === -1) { 107 | core.warning(`Cache save failed.`); 108 | } 109 | } catch (err) { 110 | console.error(err); 111 | if (earlyExit) { 112 | process.exit(1); 113 | } 114 | } 115 | 116 | // node will stay alive if any promises are not resolved, 117 | // which is a possibility if HTTP requests are dangling 118 | // due to retries or timeouts. We know that if we got here 119 | // that all promises that we care about have successfully 120 | // resolved, so simply exit with success. 121 | if (earlyExit) { 122 | process.exit(0); 123 | } 124 | } 125 | 126 | export async function saveRun(earlyExit?: boolean | undefined): Promise { 127 | try { 128 | await saveImpl(new StateProvider()); 129 | } catch (err) { 130 | console.error(err); 131 | if (earlyExit) { 132 | process.exit(1); 133 | } 134 | } 135 | 136 | // node will stay alive if any promises are not resolved, 137 | // which is a possibility if HTTP requests are dangling 138 | // due to retries or timeouts. We know that if we got here 139 | // that all promises that we care about have successfully 140 | // resolved, so simply exit with success. 141 | if (earlyExit) { 142 | process.exit(0); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Basic Options */ 4 | // "incremental": true, /* Enable incremental compilation */ 5 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ 6 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ 7 | // "allowJs": true, /* Allow javascript files to be compiled. */ 8 | // "checkJs": true, /* Report errors in .js files. */ 9 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 10 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 11 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 12 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 13 | // "outFile": "./", /* Concatenate and emit output to single file. */ 14 | "outDir": "./lib", /* Redirect output structure to the directory. */ 15 | "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 16 | // "composite": true, /* Enable project compilation */ 17 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 18 | // "removeComments": true, /* Do not emit comments to output. */ 19 | // "noEmit": true, /* Do not emit outputs. */ 20 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 21 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 22 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 23 | 24 | /* Strict Type-Checking Options */ 25 | "strict": true, /* Enable all strict type-checking options. */ 26 | "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ 27 | // "strictNullChecks": true, /* Enable strict null checks. */ 28 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 29 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 30 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 31 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 32 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 33 | 34 | /* Additional Checks */ 35 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 36 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 37 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 38 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 39 | 40 | /* Module Resolution Options */ 41 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 42 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 43 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 44 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 45 | // "typeRoots": [], /* List of folders to include type definitions from. */ 46 | // "types": [], /* Type declaration files to be included in compilation. */ 47 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 48 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 49 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 50 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 51 | 52 | /* Source Map Options */ 53 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 54 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 55 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 56 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 57 | 58 | /* Experimental Options */ 59 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 60 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 61 | }, 62 | "exclude": ["node_modules", "**/*.test.ts"] 63 | } 64 | -------------------------------------------------------------------------------- /restore/README.md: -------------------------------------------------------------------------------- 1 | # Restore action 2 | 3 | The restore action restores a cache. It works similarly to the `cache` action except that it doesn't have a post step to save the cache. This action provides granular ability to restore a cache without having to save it. It accepts the same set of inputs as the `cache` action. 4 | 5 | ## Documentation 6 | 7 | ### Inputs 8 | 9 | * `key` - An explicit key for a cache entry. See [creating a cache key](../README.md#creating-a-cache-key). 10 | * `path` - A list of files, directories, and wildcard patterns to restore. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns. 11 | * `restore-keys` - An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key. 12 | * `fail-on-cache-miss` - Fail the workflow if cache entry is not found. Default: `false` 13 | * `lookup-only` - If true, only checks if cache entry exists and skips download. Default: `false` 14 | 15 | ### Outputs 16 | 17 | * `cache-hit` - A boolean value to indicate an exact match was found for the key. 18 | * `cache-primary-key` - Cache primary key passed in the input to use in subsequent steps of the workflow. 19 | * `cache-matched-key` - 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. 20 | 21 | > **Note** 22 | `cache-hit` will be set to `true` only when cache hit occurs for the exact `key` match. For a partial key match via `restore-keys` or a cache miss, it will be set to `false`. 23 | 24 | ### Environment Variables 25 | 26 | * `SEGMENT_DOWNLOAD_TIMEOUT_MINS` - Segment download timeout (in minutes, default `10`) to abort download of the segment if not completed in the defined number of minutes. [Read more](https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout) 27 | 28 | ## Use cases 29 | 30 | As this is a newly introduced action to give users more control in their workflows, below are some use cases where one can use this action. 31 | 32 | ### Only restore cache 33 | 34 | If you are using separate jobs to create and save your cache(s) to be reused by other jobs in a repository, this action will take care of your cache restoring needs. 35 | 36 | ```yaml 37 | steps: 38 | - uses: actions/checkout@v4 39 | 40 | - uses: actions/cache/restore@v4 41 | id: cache 42 | with: 43 | path: path/to/dependencies 44 | key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} 45 | 46 | - name: Install Dependencies 47 | if: steps.cache.outputs.cache-hit != 'true' 48 | run: /install.sh 49 | 50 | - name: Build 51 | run: /build.sh 52 | 53 | - name: Publish package to public 54 | run: /publish.sh 55 | ``` 56 | 57 | Once the cache is restored, unlike `actions/cache`, this action won't run a post step to do post-processing, and the rest of the workflow will run as usual. 58 | 59 | ### Save intermediate private build artifacts 60 | 61 | In case of multi-module projects, where the built artifact of one project needs to be reused in subsequent child modules, the need to rebuild the parent module again and again with every build can be eliminated. The `actions/cache` or `actions/cache/save` action can be used to build and save the parent module artifact once, and it can be restored multiple times while building the child modules. 62 | 63 | #### Step 1 - Build the parent module and save it 64 | 65 | ```yaml 66 | steps: 67 | - uses: actions/checkout@v4 68 | 69 | - name: Build 70 | run: /build-parent-module.sh 71 | 72 | - uses: actions/cache/save@v4 73 | id: cache 74 | with: 75 | path: path/to/dependencies 76 | key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} 77 | ``` 78 | 79 | #### Step 2 - Restore the built artifact from cache using the same key and path 80 | 81 | ```yaml 82 | steps: 83 | - uses: actions/checkout@v4 84 | 85 | - uses: actions/cache/restore@v4 86 | id: cache 87 | with: 88 | path: path/to/dependencies 89 | key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} 90 | 91 | - name: Install Dependencies 92 | if: steps.cache.outputs.cache-hit != 'true' 93 | run: /install.sh 94 | 95 | - name: Build 96 | run: /build-child-module.sh 97 | 98 | - name: Publish package to public 99 | run: /publish.sh 100 | ``` 101 | 102 | ### Exit workflow on cache miss 103 | 104 | You can use `fail-on-cache-miss: true` to exit a workflow on a cache miss. This way you can restrict your workflow to only build when there is a `cache-hit`. 105 | 106 | To fail if there is no cache hit for the primary key, leave `restore-keys` empty! 107 | 108 | ```yaml 109 | steps: 110 | - uses: actions/checkout@v4 111 | 112 | - uses: actions/cache/restore@v4 113 | id: cache 114 | with: 115 | path: path/to/dependencies 116 | key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} 117 | fail-on-cache-miss: true 118 | 119 | - name: Build 120 | run: /build.sh 121 | ``` 122 | 123 | ## Tips 124 | 125 | ### Reusing primary key and restored key in the save action 126 | 127 | Usually you may want to use the same `key` with both `actions/cache/restore` and `actions/cache/save` actions. To achieve this, use `outputs` from the `restore` action to reuse the same primary key (or the key of the cache that was restored). 128 | 129 | ### Using restore action outputs to make save action behave just like the cache action 130 | 131 | The outputs `cache-primary-key` and `cache-matched-key` can be used to check if the restored cache is same as the given primary key. Alternatively, the `cache-hit` output can also be used to check if the restored was a complete match or a partially restored cache. 132 | 133 | ### Ensuring proper restores and save happen across the actions 134 | 135 | It is very important to use the same `key` and `path` that were used by either `actions/cache` or `actions/cache/save` while saving the cache. Learn more about cache key [naming](https://github.com/actions/cache#creating-a-cache-key) and [versioning](https://github.com/actions/cache#cache-version) here. 136 | -------------------------------------------------------------------------------- /RELEASES.md: -------------------------------------------------------------------------------- 1 | # Releases 2 | 3 | ### 4.3.0 4 | 5 | - Bump `@actions/cache` to [v4.1.0](https://github.com/actions/toolkit/pull/2132) 6 | 7 | ### 4.2.4 8 | 9 | - Bump `@actions/cache` to v4.0.5 10 | 11 | ### 4.2.3 12 | 13 | - Bump `@actions/cache` to v4.0.3 (obfuscates SAS token in debug logs for cache entries) 14 | 15 | ### 4.2.2 16 | 17 | - Bump `@actions/cache` to v4.0.2 18 | 19 | ### 4.2.1 20 | 21 | - Bump `@actions/cache` to v4.0.1 22 | 23 | ### 4.2.0 24 | 25 | 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. 26 | 27 | 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**. 28 | 29 | **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). 30 | 31 | If you are using pinned SHAs, please use the SHAs of versions `v4.2.0` or `v3.4.0` 32 | 33 | If you do not upgrade, all workflow runs using any of the deprecated [actions/cache](https://github.com/actions/cache) will fail. 34 | 35 | Upgrading to the recommended versions will not break your workflows. 36 | 37 | ### 4.1.2 38 | 39 | - Add GitHub Enterprise Cloud instances hostname filters to inform API endpoint choices - [#1474](https://github.com/actions/cache/pull/1474) 40 | - Security fix: Bump braces from 3.0.2 to 3.0.3 - [#1475](https://github.com/actions/cache/pull/1475) 41 | 42 | ### 4.1.1 43 | 44 | - Restore original behavior of `cache-hit` output - [#1467](https://github.com/actions/cache/pull/1467) 45 | 46 | ### 4.1.0 47 | 48 | - Ensure `cache-hit` output is set when a cache is missed - [#1404](https://github.com/actions/cache/pull/1404) 49 | - Deprecate `save-always` input - [#1452](https://github.com/actions/cache/pull/1452) 50 | 51 | ### 4.0.2 52 | 53 | - Fixed restore `fail-on-cache-miss` not working. 54 | 55 | ### 4.0.1 56 | 57 | - Updated `isGhes` check 58 | 59 | ### 4.0.0 60 | 61 | - Updated minimum runner version support from node 12 -> node 20 62 | 63 | ### 3.4.0 64 | 65 | - Integrated with the new cache service (v2) APIs 66 | 67 | ### 3.3.3 68 | 69 | - Updates @actions/cache to v3.2.3 to fix accidental mutated path arguments to `getCacheVersion` [actions/toolkit#1378](https://github.com/actions/toolkit/pull/1378) 70 | - Additional audit fixes of npm package(s) 71 | 72 | ### 3.3.2 73 | 74 | - Fixes bug with Azure SDK causing blob downloads to get stuck. 75 | 76 | ### 3.3.1 77 | 78 | - Reduced segment size to 128MB and segment timeout to 10 minutes to fail fast in case the cache download is stuck. 79 | 80 | ### 3.3.0 81 | 82 | - Added option to lookup cache without downloading it. 83 | 84 | ### 3.2.6 85 | 86 | - Fix zstd not being used after zstd version upgrade to 1.5.4 on hosted runners. 87 | 88 | ### 3.2.5 89 | 90 | - Added fix to prevent from setting MYSYS environment variable globally. 91 | 92 | ### 3.2.4 93 | 94 | - Added option to fail job on cache miss. 95 | 96 | ### 3.2.3 97 | 98 | - Support cross os caching on Windows as an opt-in feature. 99 | - Fix issue with symlink restoration on Windows for cross-os caches. 100 | 101 | ### 3.2.2 102 | 103 | - Reverted the changes made in 3.2.1 to use gnu tar and zstd by default on windows. 104 | 105 | ### 3.2.1 106 | 107 | - Update `@actions/cache` on windows to use gnu tar and zstd by default and fallback to bsdtar and zstd if gnu tar is not available. ([issue](https://github.com/actions/cache/issues/984)) 108 | - Added support for fallback to gzip to restore old caches on windows. 109 | - Added logs for cache version in case of a cache miss. 110 | 111 | ### 3.2.0 112 | 113 | - Released the two new actions - [restore](restore/action.yml) and [save](save/action.yml) for granular control on cache 114 | 115 | ### 3.2.0-beta.1 116 | 117 | - Added two new actions - [restore](restore/action.yml) and [save](save/action.yml) for granular control on cache. 118 | 119 | ### 3.1.0-beta.3 120 | 121 | - Bug fixes for bsdtar fallback if gnutar not available and gzip fallback if cache saved using old cache action on windows. 122 | 123 | ### 3.1.0-beta.2 124 | 125 | - Added support for fallback to gzip to restore old caches on windows. 126 | 127 | ### 3.1.0-beta.1 128 | 129 | - Update `@actions/cache` on windows to use gnu tar and zstd by default and fallback to bsdtar and zstd if gnu tar is not available. ([issue](https://github.com/actions/cache/issues/984)) 130 | 131 | ### 3.0.11 132 | 133 | - Update toolkit version to 3.0.5 to include `@actions/core@^1.10.0` 134 | - Update `@actions/cache` to use updated `saveState` and `setOutput` functions from `@actions/core@^1.10.0` 135 | 136 | ### 3.0.10 137 | 138 | - Fix a bug with sorting inputs. 139 | - Update definition for restore-keys in README.md 140 | 141 | ### 3.0.9 142 | 143 | - Enhanced the warning message for cache unavailablity in case of GHES. 144 | 145 | ### 3.0.8 146 | 147 | - Fix zstd not working for windows on gnu tar in issues [#888](https://github.com/actions/cache/issues/888) and [#891](https://github.com/actions/cache/issues/891). 148 | - Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MINS`. Default is 60 minutes. 149 | 150 | ### 3.0.7 151 | 152 | - Fixed [#810](https://github.com/actions/cache/issues/810) - download stuck issue. A new timeout is introduced in the download process to abort the download if it gets stuck and doesn't finish within an hour. 153 | 154 | ### 3.0.6 155 | 156 | - Fixed [#809](https://github.com/actions/cache/issues/809) - zstd -d: no such file or directory error 157 | - Fixed [#833](https://github.com/actions/cache/issues/833) - cache doesn't work with github workspace directory 158 | 159 | ### 3.0.5 160 | 161 | - Removed error handling by consuming actions/cache 3.0 toolkit, Now cache server error handling will be done by toolkit. ([PR](https://github.com/actions/cache/pull/834)) 162 | 163 | ### 3.0.4 164 | 165 | - Fixed tar creation error while trying to create tar with path as `~/` home folder on `ubuntu-latest`. ([issue](https://github.com/actions/cache/issues/689)) 166 | 167 | ### 3.0.3 168 | 169 | - Fixed avoiding empty cache save when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) 170 | 171 | ### 3.0.2 172 | 173 | - Added support for dynamic cache size cap on GHES. 174 | 175 | ### 3.0.1 176 | 177 | - Added support for caching from GHES 3.5. 178 | - Fixed download issue for files > 2GB during restore. 179 | 180 | ### 3.0.0 181 | 182 | - Updated minimum runner version support from node 12 -> node 16 183 | -------------------------------------------------------------------------------- /__tests__/restoreOnly.test.ts: -------------------------------------------------------------------------------- 1 | import * as cache from "@actions/cache"; 2 | import * as core from "@actions/core"; 3 | 4 | import { Events, RefKey } from "../src/constants"; 5 | import { restoreOnlyRun } from "../src/restoreImpl"; 6 | import * as actionUtils from "../src/utils/actionUtils"; 7 | import * as testUtils from "../src/utils/testUtils"; 8 | 9 | jest.mock("../src/utils/actionUtils"); 10 | 11 | beforeAll(() => { 12 | jest.spyOn(actionUtils, "isExactKeyMatch").mockImplementation( 13 | (key, cacheResult) => { 14 | const actualUtils = jest.requireActual("../src/utils/actionUtils"); 15 | return actualUtils.isExactKeyMatch(key, cacheResult); 16 | } 17 | ); 18 | 19 | jest.spyOn(actionUtils, "isValidEvent").mockImplementation(() => { 20 | const actualUtils = jest.requireActual("../src/utils/actionUtils"); 21 | return actualUtils.isValidEvent(); 22 | }); 23 | 24 | jest.spyOn(actionUtils, "getInputAsArray").mockImplementation( 25 | (name, options) => { 26 | const actualUtils = jest.requireActual("../src/utils/actionUtils"); 27 | return actualUtils.getInputAsArray(name, options); 28 | } 29 | ); 30 | 31 | jest.spyOn(actionUtils, "getInputAsBool").mockImplementation( 32 | (name, options) => { 33 | return jest 34 | .requireActual("../src/utils/actionUtils") 35 | .getInputAsBool(name, options); 36 | } 37 | ); 38 | }); 39 | 40 | beforeEach(() => { 41 | jest.restoreAllMocks(); 42 | process.env[Events.Key] = Events.Push; 43 | process.env[RefKey] = "refs/heads/feature-branch"; 44 | 45 | jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); 46 | jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation( 47 | () => true 48 | ); 49 | }); 50 | 51 | afterEach(() => { 52 | testUtils.clearInputs(); 53 | delete process.env[Events.Key]; 54 | delete process.env[RefKey]; 55 | }); 56 | 57 | test("restore with no cache found", async () => { 58 | const path = "node_modules"; 59 | const key = "node-test"; 60 | testUtils.setInputs({ 61 | path: path, 62 | key, 63 | enableCrossOsArchive: false 64 | }); 65 | 66 | const infoMock = jest.spyOn(core, "info"); 67 | const failedMock = jest.spyOn(core, "setFailed"); 68 | const outputMock = jest.spyOn(core, "setOutput"); 69 | const restoreCacheMock = jest 70 | .spyOn(cache, "restoreCache") 71 | .mockImplementationOnce(() => { 72 | return Promise.resolve(undefined); 73 | }); 74 | 75 | await restoreOnlyRun(); 76 | 77 | expect(restoreCacheMock).toHaveBeenCalledTimes(1); 78 | expect(restoreCacheMock).toHaveBeenCalledWith( 79 | [path], 80 | key, 81 | [], 82 | { 83 | lookupOnly: false 84 | }, 85 | false 86 | ); 87 | 88 | expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); 89 | expect(outputMock).toHaveBeenCalledTimes(1); 90 | expect(failedMock).toHaveBeenCalledTimes(0); 91 | 92 | expect(infoMock).toHaveBeenCalledWith( 93 | `Cache not found for input keys: ${key}` 94 | ); 95 | }); 96 | 97 | test("restore with restore keys and no cache found", async () => { 98 | const path = "node_modules"; 99 | const key = "node-test"; 100 | const restoreKey = "node-"; 101 | testUtils.setInputs({ 102 | path: path, 103 | key, 104 | restoreKeys: [restoreKey], 105 | enableCrossOsArchive: false 106 | }); 107 | 108 | const infoMock = jest.spyOn(core, "info"); 109 | const failedMock = jest.spyOn(core, "setFailed"); 110 | const outputMock = jest.spyOn(core, "setOutput"); 111 | const restoreCacheMock = jest 112 | .spyOn(cache, "restoreCache") 113 | .mockImplementationOnce(() => { 114 | return Promise.resolve(undefined); 115 | }); 116 | 117 | await restoreOnlyRun(); 118 | 119 | expect(restoreCacheMock).toHaveBeenCalledTimes(1); 120 | expect(restoreCacheMock).toHaveBeenCalledWith( 121 | [path], 122 | key, 123 | [restoreKey], 124 | { 125 | lookupOnly: false 126 | }, 127 | false 128 | ); 129 | 130 | expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); 131 | expect(failedMock).toHaveBeenCalledTimes(0); 132 | 133 | expect(infoMock).toHaveBeenCalledWith( 134 | `Cache not found for input keys: ${key}, ${restoreKey}` 135 | ); 136 | }); 137 | 138 | test("restore with cache found for key", async () => { 139 | const path = "node_modules"; 140 | const key = "node-test"; 141 | testUtils.setInputs({ 142 | path: path, 143 | key, 144 | enableCrossOsArchive: false 145 | }); 146 | 147 | const infoMock = jest.spyOn(core, "info"); 148 | const failedMock = jest.spyOn(core, "setFailed"); 149 | const outputMock = jest.spyOn(core, "setOutput"); 150 | const restoreCacheMock = jest 151 | .spyOn(cache, "restoreCache") 152 | .mockImplementationOnce(() => { 153 | return Promise.resolve(key); 154 | }); 155 | 156 | await restoreOnlyRun(); 157 | 158 | expect(restoreCacheMock).toHaveBeenCalledTimes(1); 159 | expect(restoreCacheMock).toHaveBeenCalledWith( 160 | [path], 161 | key, 162 | [], 163 | { 164 | lookupOnly: false 165 | }, 166 | false 167 | ); 168 | 169 | expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); 170 | expect(outputMock).toHaveBeenCalledWith("cache-hit", "true"); 171 | expect(outputMock).toHaveBeenCalledWith("cache-matched-key", key); 172 | 173 | expect(outputMock).toHaveBeenCalledTimes(3); 174 | 175 | expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`); 176 | expect(failedMock).toHaveBeenCalledTimes(0); 177 | }); 178 | 179 | test("restore with cache found for restore key", async () => { 180 | const path = "node_modules"; 181 | const key = "node-test"; 182 | const restoreKey = "node-"; 183 | testUtils.setInputs({ 184 | path: path, 185 | key, 186 | restoreKeys: [restoreKey], 187 | enableCrossOsArchive: false 188 | }); 189 | 190 | const infoMock = jest.spyOn(core, "info"); 191 | const failedMock = jest.spyOn(core, "setFailed"); 192 | const outputMock = jest.spyOn(core, "setOutput"); 193 | const restoreCacheMock = jest 194 | .spyOn(cache, "restoreCache") 195 | .mockImplementationOnce(() => { 196 | return Promise.resolve(restoreKey); 197 | }); 198 | 199 | await restoreOnlyRun(); 200 | 201 | expect(restoreCacheMock).toHaveBeenCalledTimes(1); 202 | expect(restoreCacheMock).toHaveBeenCalledWith( 203 | [path], 204 | key, 205 | [restoreKey], 206 | { 207 | lookupOnly: false 208 | }, 209 | false 210 | ); 211 | 212 | expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); 213 | expect(outputMock).toHaveBeenCalledWith("cache-hit", "false"); 214 | expect(outputMock).toHaveBeenCalledWith("cache-matched-key", restoreKey); 215 | 216 | expect(outputMock).toHaveBeenCalledTimes(3); 217 | 218 | expect(infoMock).toHaveBeenCalledWith( 219 | `Cache restored from key: ${restoreKey}` 220 | ); 221 | expect(failedMock).toHaveBeenCalledTimes(0); 222 | }); 223 | -------------------------------------------------------------------------------- /__tests__/downloadValidation.test.ts: -------------------------------------------------------------------------------- 1 | import * as core from "@actions/core"; 2 | import * as fs from "fs"; 3 | import nock from "nock"; 4 | import * as path from "path"; 5 | 6 | import { DownloadValidationError, restoreCache } from "../src/custom/cache"; 7 | import { downloadCacheHttpClientConcurrent } from "../src/custom/downloadUtils"; 8 | 9 | // Mock the core module 10 | jest.mock("@actions/core"); 11 | 12 | // Mock fs for file size checks 13 | jest.mock("fs", () => ({ 14 | ...jest.requireActual("fs"), 15 | promises: { 16 | ...jest.requireActual("fs").promises, 17 | open: jest.fn() 18 | } 19 | })); 20 | 21 | describe("Download Validation", () => { 22 | const testArchivePath = "/tmp/test-cache.tar.gz"; 23 | const testUrl = "https://example.com/cache.tar.gz"; 24 | 25 | beforeEach(() => { 26 | jest.clearAllMocks(); 27 | nock.cleanAll(); 28 | }); 29 | 30 | afterEach(() => { 31 | nock.cleanAll(); 32 | }); 33 | 34 | describe("downloadCacheHttpClientConcurrent", () => { 35 | it("should validate downloaded size matches expected content-length", async () => { 36 | const expectedSize = 1024; 37 | const mockFileDescriptor = { 38 | write: jest.fn().mockResolvedValue(undefined), 39 | close: jest.fn().mockResolvedValue(undefined) 40 | }; 41 | 42 | (fs.promises.open as jest.Mock).mockResolvedValue( 43 | mockFileDescriptor 44 | ); 45 | 46 | // Mock the initial range request to get content length 47 | nock("https://example.com") 48 | .get("/cache.tar.gz") 49 | .reply(206, "partial content", { 50 | "content-range": `bytes 0-1/${expectedSize}` 51 | }); 52 | 53 | // Mock the actual content download with wrong size 54 | nock("https://example.com") 55 | .get("/cache.tar.gz") 56 | .reply(206, Buffer.alloc(512), { 57 | // Return only 512 bytes instead of 1024 58 | "content-range": "bytes 0-511/1024" 59 | }); 60 | 61 | await expect( 62 | downloadCacheHttpClientConcurrent(testUrl, testArchivePath, { 63 | timeoutInMs: 30000, 64 | partSize: 1024 65 | }) 66 | ).rejects.toThrow( 67 | "Download validation failed: Expected 1024 bytes but downloaded 512 bytes" 68 | ); 69 | }); 70 | 71 | it("should succeed when downloaded size matches expected", async () => { 72 | const expectedSize = 1024; 73 | const testContent = Buffer.alloc(expectedSize); 74 | const mockFileDescriptor = { 75 | write: jest.fn().mockResolvedValue(undefined), 76 | close: jest.fn().mockResolvedValue(undefined) 77 | }; 78 | 79 | (fs.promises.open as jest.Mock).mockResolvedValue( 80 | mockFileDescriptor 81 | ); 82 | 83 | // Mock the initial range request 84 | nock("https://example.com") 85 | .get("/cache.tar.gz") 86 | .reply(206, "partial content", { 87 | "content-range": `bytes 0-1/${expectedSize}` 88 | }); 89 | 90 | // Mock the actual content download with correct size 91 | nock("https://example.com") 92 | .get("/cache.tar.gz") 93 | .reply(206, testContent, { 94 | "content-range": `bytes 0-${ 95 | expectedSize - 1 96 | }/${expectedSize}` 97 | }); 98 | 99 | await expect( 100 | downloadCacheHttpClientConcurrent(testUrl, testArchivePath, { 101 | timeoutInMs: 30000, 102 | partSize: expectedSize 103 | }) 104 | ).resolves.not.toThrow(); 105 | }); 106 | }); 107 | 108 | describe("restoreCache validation", () => { 109 | beforeEach(() => { 110 | // Mock environment variables for S3 backend 111 | process.env.RUNS_ON_S3_BUCKET_CACHE = "test-bucket"; 112 | process.env.RUNS_ON_AWS_REGION = "us-east-1"; 113 | }); 114 | 115 | afterEach(() => { 116 | delete process.env.RUNS_ON_S3_BUCKET_CACHE; 117 | delete process.env.RUNS_ON_AWS_REGION; 118 | }); 119 | 120 | it("should throw DownloadValidationError for empty files", async () => { 121 | // Mock the cache lookup to return a valid cache entry 122 | const mockCacheHttpClient = require("../src/custom/backend"); 123 | jest.spyOn(mockCacheHttpClient, "getCacheEntry").mockResolvedValue({ 124 | cacheKey: "test-key", 125 | archiveLocation: "https://s3.example.com/cache.tar.gz" 126 | }); 127 | 128 | // Mock the download to succeed 129 | jest.spyOn(mockCacheHttpClient, "downloadCache").mockResolvedValue( 130 | undefined 131 | ); 132 | 133 | // Mock utils to return 0 file size (empty file) 134 | const mockUtils = require("@actions/cache/lib/internal/cacheUtils"); 135 | jest.spyOn(mockUtils, "getArchiveFileSizeInBytes").mockReturnValue( 136 | 0 137 | ); 138 | jest.spyOn(mockUtils, "createTempDirectory").mockResolvedValue( 139 | "/tmp" 140 | ); 141 | jest.spyOn(mockUtils, "getCacheFileName").mockReturnValue( 142 | "cache.tar.gz" 143 | ); 144 | 145 | const coreSpy = jest.spyOn(core, "warning"); 146 | 147 | const result = await restoreCache(["/test/path"], "test-key"); 148 | 149 | expect(result).toBeUndefined(); // Should return undefined on validation failure 150 | expect(coreSpy).toHaveBeenCalledWith( 151 | expect.stringContaining( 152 | "Cache download validation failed: Downloaded cache archive is empty" 153 | ) 154 | ); 155 | }); 156 | 157 | it("should succeed with valid file size", async () => { 158 | // Mock the cache lookup to return a valid cache entry 159 | const mockCacheHttpClient = require("../src/custom/backend"); 160 | jest.spyOn(mockCacheHttpClient, "getCacheEntry").mockResolvedValue({ 161 | cacheKey: "test-key", 162 | archiveLocation: "https://s3.example.com/cache.tar.gz" 163 | }); 164 | 165 | // Mock the download to succeed 166 | jest.spyOn(mockCacheHttpClient, "downloadCache").mockResolvedValue( 167 | undefined 168 | ); 169 | 170 | // Mock utils to return valid file size (>= 512 bytes) 171 | const mockUtils = require("@actions/cache/lib/internal/cacheUtils"); 172 | jest.spyOn(mockUtils, "getArchiveFileSizeInBytes").mockReturnValue( 173 | 1024 174 | ); 175 | jest.spyOn(mockUtils, "createTempDirectory").mockResolvedValue( 176 | "/tmp" 177 | ); 178 | jest.spyOn(mockUtils, "getCacheFileName").mockReturnValue( 179 | "cache.tar.gz" 180 | ); 181 | jest.spyOn(mockUtils, "getCompressionMethod").mockResolvedValue( 182 | "gzip" 183 | ); 184 | 185 | // Mock tar operations 186 | const mockTar = require("@actions/cache/lib/internal/tar"); 187 | jest.spyOn(mockTar, "extractTar").mockResolvedValue(undefined); 188 | jest.spyOn(mockTar, "listTar").mockResolvedValue(undefined); 189 | 190 | const result = await restoreCache(["/test/path"], "test-key"); 191 | 192 | expect(result).toBe("test-key"); // Should return the cache key on success 193 | }); 194 | }); 195 | }); 196 | -------------------------------------------------------------------------------- /src/custom/cache.ts: -------------------------------------------------------------------------------- 1 | // https://github.com/actions/toolkit/blob/%40actions/cache%403.2.2/packages/cache/src/cache.ts 2 | 3 | import * as core from "@actions/core"; 4 | import * as path from "path"; 5 | import * as utils from "@actions/cache/lib/internal/cacheUtils"; 6 | import * as cacheHttpClient from "./backend"; 7 | import { 8 | createTar, 9 | extractTar, 10 | listTar 11 | } from "@actions/cache/lib/internal/tar"; 12 | import { DownloadOptions, UploadOptions } from "@actions/cache/lib/options"; 13 | 14 | export class ValidationError extends Error { 15 | constructor(message: string) { 16 | super(message); 17 | this.name = "ValidationError"; 18 | Object.setPrototypeOf(this, ValidationError.prototype); 19 | } 20 | } 21 | 22 | export class ReserveCacheError extends Error { 23 | constructor(message: string) { 24 | super(message); 25 | this.name = "ReserveCacheError"; 26 | Object.setPrototypeOf(this, ReserveCacheError.prototype); 27 | } 28 | } 29 | 30 | export class DownloadValidationError extends Error { 31 | constructor(message: string) { 32 | super(message); 33 | this.name = "DownloadValidationError"; 34 | Object.setPrototypeOf(this, DownloadValidationError.prototype); 35 | } 36 | } 37 | 38 | function checkPaths(paths: string[]): void { 39 | if (!paths || paths.length === 0) { 40 | throw new ValidationError( 41 | `Path Validation Error: At least one directory or file path is required` 42 | ); 43 | } 44 | } 45 | 46 | function checkKey(key: string): void { 47 | if (key.length > 512) { 48 | throw new ValidationError( 49 | `Key Validation Error: ${key} cannot be larger than 512 characters.` 50 | ); 51 | } 52 | const regex = /^[^,]*$/; 53 | if (!regex.test(key)) { 54 | throw new ValidationError( 55 | `Key Validation Error: ${key} cannot contain commas.` 56 | ); 57 | } 58 | } 59 | 60 | /** 61 | * isFeatureAvailable to check the presence of Actions cache service 62 | * 63 | * @returns boolean return true if Actions cache service feature is available, otherwise false 64 | */ 65 | 66 | export function isFeatureAvailable(): boolean { 67 | return !!process.env["ACTIONS_CACHE_URL"]; 68 | } 69 | 70 | /** 71 | * Restores cache from keys 72 | * 73 | * @param paths a list of file paths to restore from the cache 74 | * @param primaryKey an explicit key for restoring the cache 75 | * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key 76 | * @param downloadOptions cache download options 77 | * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform 78 | * @returns string returns the key for the cache hit, otherwise returns undefined 79 | */ 80 | export async function restoreCache( 81 | paths: string[], 82 | primaryKey: string, 83 | restoreKeys?: string[], 84 | options?: DownloadOptions, 85 | enableCrossOsArchive = false 86 | ): Promise { 87 | checkPaths(paths); 88 | 89 | restoreKeys = restoreKeys || []; 90 | const keys = [primaryKey, ...restoreKeys]; 91 | 92 | core.debug("Resolved Keys:"); 93 | core.debug(JSON.stringify(keys)); 94 | 95 | if (keys.length > 10) { 96 | throw new ValidationError( 97 | `Key Validation Error: Keys are limited to a maximum of 10.` 98 | ); 99 | } 100 | for (const key of keys) { 101 | checkKey(key); 102 | } 103 | 104 | const compressionMethod = await utils.getCompressionMethod(); 105 | let archivePath = ""; 106 | try { 107 | // path are needed to compute version 108 | const cacheEntry = await cacheHttpClient.getCacheEntry(keys, paths, { 109 | compressionMethod, 110 | enableCrossOsArchive 111 | }); 112 | if (!cacheEntry?.archiveLocation) { 113 | // Cache not found 114 | return undefined; 115 | } 116 | 117 | if (options?.lookupOnly) { 118 | core.info("Lookup only - skipping download"); 119 | return cacheEntry.cacheKey; 120 | } 121 | 122 | archivePath = path.join( 123 | await utils.createTempDirectory(), 124 | utils.getCacheFileName(compressionMethod) 125 | ); 126 | core.debug(`Archive Path: ${archivePath}`); 127 | 128 | // Download the cache from the cache entry 129 | await cacheHttpClient.downloadCache( 130 | cacheEntry.archiveLocation, 131 | archivePath, 132 | options 133 | ); 134 | 135 | if (core.isDebug()) { 136 | await listTar(archivePath, compressionMethod); 137 | } 138 | 139 | const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); 140 | core.info( 141 | `Cache Size: ~${Math.round( 142 | archiveFileSize / (1024 * 1024) 143 | )} MB (${archiveFileSize} B)` 144 | ); 145 | 146 | // Validate downloaded archive 147 | if (archiveFileSize === 0) { 148 | throw new DownloadValidationError( 149 | "Downloaded cache archive is empty (0 bytes). This may indicate a failed download or corrupted cache." 150 | ); 151 | } 152 | 153 | await extractTar(archivePath, compressionMethod); 154 | core.info("Cache restored successfully"); 155 | 156 | return cacheEntry.cacheKey; 157 | } catch (error) { 158 | const typedError = error as Error; 159 | if (typedError.name === ValidationError.name) { 160 | throw error; 161 | } else if (typedError.name === DownloadValidationError.name) { 162 | // Log download validation errors as warnings but don't fail the workflow 163 | core.warning( 164 | `Cache download validation failed: ${typedError.message}` 165 | ); 166 | } else { 167 | // Supress all non-validation cache related errors because caching should be optional 168 | core.warning(`Failed to restore: ${(error as Error).message}`); 169 | } 170 | } finally { 171 | // Try to delete the archive to save space 172 | try { 173 | await utils.unlinkFile(archivePath); 174 | } catch (error) { 175 | core.debug(`Failed to delete archive: ${error}`); 176 | } 177 | } 178 | 179 | return undefined; 180 | } 181 | 182 | /** 183 | * Saves a list of files with the specified key 184 | * 185 | * @param paths a list of file paths to be cached 186 | * @param key an explicit key for restoring the cache 187 | * @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform 188 | * @param options cache upload options 189 | * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails 190 | */ 191 | export async function saveCache( 192 | paths: string[], 193 | key: string, 194 | options?: UploadOptions, 195 | enableCrossOsArchive = false 196 | ): Promise { 197 | checkPaths(paths); 198 | checkKey(key); 199 | 200 | const compressionMethod = await utils.getCompressionMethod(); 201 | let cacheId = -1; 202 | 203 | const cachePaths = await utils.resolvePaths(paths); 204 | core.debug("Cache Paths:"); 205 | core.debug(`${JSON.stringify(cachePaths)}`); 206 | 207 | if (cachePaths.length === 0) { 208 | throw new Error( 209 | `Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.` 210 | ); 211 | } 212 | 213 | const archiveFolder = await utils.createTempDirectory(); 214 | const archivePath = path.join( 215 | archiveFolder, 216 | utils.getCacheFileName(compressionMethod) 217 | ); 218 | 219 | core.debug(`Archive Path: ${archivePath}`); 220 | 221 | try { 222 | await createTar(archiveFolder, cachePaths, compressionMethod); 223 | if (core.isDebug()) { 224 | await listTar(archivePath, compressionMethod); 225 | } 226 | const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); 227 | core.debug(`File Size: ${archiveFileSize}`); 228 | 229 | await cacheHttpClient.saveCache(key, paths, archivePath, { 230 | compressionMethod, 231 | enableCrossOsArchive, 232 | cacheSize: archiveFileSize 233 | }); 234 | 235 | // dummy cacheId, if we get there without raising, it means the cache has been saved 236 | cacheId = 1; 237 | } catch (error) { 238 | const typedError = error as Error; 239 | if (typedError.name === ValidationError.name) { 240 | throw error; 241 | } else if (typedError.name === ReserveCacheError.name) { 242 | core.info(`Failed to save: ${typedError.message}`); 243 | } else { 244 | core.warning(`Failed to save: ${typedError.message}`); 245 | } 246 | } finally { 247 | // Try to delete the archive to save space 248 | try { 249 | await utils.unlinkFile(archivePath); 250 | } catch (error) { 251 | core.debug(`Failed to delete archive: ${error}`); 252 | } 253 | } 254 | 255 | return cacheId; 256 | } 257 | -------------------------------------------------------------------------------- /src/custom/backend.ts: -------------------------------------------------------------------------------- 1 | import { 2 | S3Client, 3 | GetObjectCommand, 4 | ListObjectsV2Command 5 | } from "@aws-sdk/client-s3"; 6 | const { getSignedUrl } = require("@aws-sdk/s3-request-presigner"); 7 | import { createReadStream } from "fs"; 8 | import * as crypto from "crypto"; 9 | import { 10 | DownloadOptions, 11 | getDownloadOptions 12 | } from "@actions/cache/lib/options"; 13 | import { CompressionMethod } from "@actions/cache/lib/internal/constants"; 14 | import * as core from "@actions/core"; 15 | import * as utils from "@actions/cache/lib/internal/cacheUtils"; 16 | import { Upload } from "@aws-sdk/lib-storage"; 17 | import { downloadCacheHttpClientConcurrent } from "./downloadUtils"; 18 | 19 | export interface ArtifactCacheEntry { 20 | cacheKey?: string; 21 | scope?: string; 22 | cacheVersion?: string; 23 | creationTime?: string; 24 | archiveLocation?: string; 25 | } 26 | 27 | // if executing from RunsOn, unset any existing AWS credential env variables so that we can use the IAM instance profile for credentials 28 | // see unsetCredentials() in https://github.com/aws-actions/configure-aws-credentials/blob/v4.0.2/src/helpers.ts#L44 29 | // Note: we preserve AWS_REGION and AWS_DEFAULT_REGION as they are needed for SDK initialization 30 | if (process.env.RUNS_ON_RUNNER_NAME && process.env.RUNS_ON_RUNNER_NAME !== "") { 31 | delete process.env.AWS_ACCESS_KEY_ID; 32 | delete process.env.AWS_SECRET_ACCESS_KEY; 33 | delete process.env.AWS_SESSION_TOKEN; 34 | } 35 | 36 | const versionSalt = "1.0"; 37 | const bucketName = process.env.RUNS_ON_S3_BUCKET_CACHE; 38 | const endpoint = process.env.RUNS_ON_S3_BUCKET_ENDPOINT; 39 | const region = 40 | process.env.RUNS_ON_AWS_REGION || 41 | process.env.AWS_REGION || 42 | process.env.AWS_DEFAULT_REGION; 43 | const forcePathStyle = 44 | process.env.RUNS_ON_S3_FORCE_PATH_STYLE === "true" || 45 | process.env.AWS_S3_FORCE_PATH_STYLE === "true"; 46 | 47 | const uploadQueueSize = Number(process.env.UPLOAD_QUEUE_SIZE || "4"); 48 | const uploadPartSize = 49 | Number(process.env.UPLOAD_PART_SIZE || "32") * 1024 * 1024; 50 | const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); 51 | const downloadPartSize = 52 | Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; 53 | 54 | const s3Client = new S3Client({ region, forcePathStyle, endpoint }); 55 | 56 | export function getCacheVersion( 57 | paths: string[], 58 | compressionMethod?: CompressionMethod, 59 | enableCrossOsArchive = false 60 | ): string { 61 | // don't pass changes upstream 62 | const components = paths.slice(); 63 | 64 | // Add compression method to cache version to restore 65 | // compressed cache as per compression method 66 | if (compressionMethod) { 67 | components.push(compressionMethod); 68 | } 69 | 70 | // Only check for windows platforms if enableCrossOsArchive is false 71 | if (process.platform === "win32" && !enableCrossOsArchive) { 72 | components.push("windows-only"); 73 | } 74 | 75 | // Add salt to cache version to support breaking changes in cache entry 76 | components.push(versionSalt); 77 | 78 | return crypto 79 | .createHash("sha256") 80 | .update(components.join("|")) 81 | .digest("hex"); 82 | } 83 | 84 | function getS3Prefix( 85 | paths: string[], 86 | { compressionMethod, enableCrossOsArchive } 87 | ): string { 88 | const repository = process.env.GITHUB_REPOSITORY; 89 | const version = getCacheVersion( 90 | paths, 91 | compressionMethod, 92 | enableCrossOsArchive 93 | ); 94 | 95 | return ["cache", repository, version].join("/"); 96 | } 97 | 98 | export async function getCacheEntry( 99 | keys, 100 | paths, 101 | { compressionMethod, enableCrossOsArchive } 102 | ) { 103 | const cacheEntry: ArtifactCacheEntry = {}; 104 | 105 | // Find the most recent key matching one of the restoreKeys prefixes 106 | for (const restoreKey of keys) { 107 | const s3Prefix = getS3Prefix(paths, { 108 | compressionMethod, 109 | enableCrossOsArchive 110 | }); 111 | const listObjectsParams = { 112 | Bucket: bucketName, 113 | Prefix: [s3Prefix, restoreKey].join("/") 114 | }; 115 | 116 | try { 117 | const { Contents = [] } = await s3Client.send( 118 | new ListObjectsV2Command(listObjectsParams) 119 | ); 120 | if (Contents.length > 0) { 121 | // Sort keys by LastModified time in descending order 122 | const sortedKeys = Contents.sort( 123 | (a, b) => Number(b.LastModified) - Number(a.LastModified) 124 | ); 125 | const s3Path = sortedKeys[0].Key; // Return the most recent key 126 | cacheEntry.cacheKey = s3Path?.replace(`${s3Prefix}/`, ""); 127 | cacheEntry.archiveLocation = `s3://${bucketName}/${s3Path}`; 128 | return cacheEntry; 129 | } 130 | } catch (error) { 131 | console.error( 132 | `Error listing objects with prefix ${restoreKey} in bucket ${bucketName}:`, 133 | error 134 | ); 135 | } 136 | } 137 | 138 | return cacheEntry; // No keys found 139 | } 140 | 141 | export async function downloadCache( 142 | archiveLocation: string, 143 | archivePath: string, 144 | options?: DownloadOptions 145 | ): Promise { 146 | if (!bucketName) { 147 | throw new Error("Environment variable RUNS_ON_S3_BUCKET_CACHE not set"); 148 | } 149 | 150 | if (!region) { 151 | throw new Error("Environment variable RUNS_ON_AWS_REGION not set"); 152 | } 153 | 154 | const archiveUrl = new URL(archiveLocation); 155 | const objectKey = archiveUrl.pathname.slice(1); 156 | 157 | // Retry logic for download validation failures 158 | const maxRetries = 3; 159 | let lastError: Error | undefined; 160 | 161 | for (let attempt = 1; attempt <= maxRetries; attempt++) { 162 | try { 163 | const command = new GetObjectCommand({ 164 | Bucket: bucketName, 165 | Key: objectKey 166 | }); 167 | const url = await getSignedUrl(s3Client, command, { 168 | expiresIn: 3600 169 | }); 170 | 171 | await downloadCacheHttpClientConcurrent(url, archivePath, { 172 | ...options, 173 | downloadConcurrency: downloadQueueSize, 174 | concurrentBlobDownloads: true, 175 | partSize: downloadPartSize 176 | }); 177 | 178 | // If we get here, download succeeded 179 | return; 180 | } catch (error) { 181 | const errorMessage = (error as Error).message; 182 | lastError = error as Error; 183 | 184 | // Only retry on validation failures, not on other errors 185 | if ( 186 | errorMessage.includes("Download validation failed") || 187 | errorMessage.includes("Range request not supported") || 188 | errorMessage.includes("Content-Range header") 189 | ) { 190 | if (attempt < maxRetries) { 191 | const delayMs = Math.pow(2, attempt - 1) * 1000; // exponential backoff 192 | core.warning( 193 | `Download attempt ${attempt} failed: ${errorMessage}. Retrying in ${delayMs}ms...` 194 | ); 195 | await new Promise(resolve => setTimeout(resolve, delayMs)); 196 | continue; 197 | } 198 | } 199 | 200 | // For non-retryable errors or max retries reached, throw the error 201 | throw error; 202 | } 203 | } 204 | 205 | // This should never be reached, but just in case 206 | throw lastError || new Error("Download failed after all retry attempts"); 207 | } 208 | 209 | export async function saveCache( 210 | key: string, 211 | paths: string[], 212 | archivePath: string, 213 | { compressionMethod, enableCrossOsArchive, cacheSize: archiveFileSize } 214 | ): Promise { 215 | if (!bucketName) { 216 | throw new Error("Environment variable RUNS_ON_S3_BUCKET_CACHE not set"); 217 | } 218 | 219 | if (!region) { 220 | throw new Error("Environment variable RUNS_ON_AWS_REGION not set"); 221 | } 222 | 223 | const s3Prefix = getS3Prefix(paths, { 224 | compressionMethod, 225 | enableCrossOsArchive 226 | }); 227 | const s3Key = `${s3Prefix}/${key}`; 228 | 229 | const multipartUpload = new Upload({ 230 | client: s3Client, 231 | params: { 232 | Bucket: bucketName, 233 | Key: s3Key, 234 | Body: createReadStream(archivePath) 235 | }, 236 | // Part size in bytes 237 | partSize: uploadPartSize, 238 | // Max concurrency 239 | queueSize: uploadQueueSize 240 | }); 241 | 242 | // Commit Cache 243 | const cacheSize = utils.getArchiveFileSizeInBytes(archivePath); 244 | core.info( 245 | `Cache Size: ~${Math.round( 246 | cacheSize / (1024 * 1024) 247 | )} MB (${cacheSize} B)` 248 | ); 249 | 250 | const totalParts = Math.ceil(cacheSize / uploadPartSize); 251 | core.info(`Uploading cache from ${archivePath} to ${bucketName}/${s3Key}`); 252 | multipartUpload.on("httpUploadProgress", progress => { 253 | core.info(`Uploaded part ${progress.part}/${totalParts}.`); 254 | }); 255 | 256 | await multipartUpload.done(); 257 | core.info(`Cache saved successfully.`); 258 | } 259 | --------------------------------------------------------------------------------