mirror of
https://github.com/actions/cache.git
synced 2025-12-18 04:58:59 +08:00
Compare commits
1 Commits
v3.5.0-wor
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4755714be1 |
6
.github/workflows/issue-opened-workflow.yml
vendored
6
.github/workflows/issue-opened-workflow.yml
vendored
@@ -14,3 +14,9 @@ jobs:
|
||||
- name: add_assignees
|
||||
run: |
|
||||
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.issue.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'
|
||||
|
||||
- uses: actions/add-to-project@v0.4.0
|
||||
name: Add to Project Board
|
||||
with:
|
||||
project-url: https://github.com/orgs/actions/projects/12
|
||||
github-token: ${{ secrets.CACHE_BOARD_TOKEN }}
|
||||
|
||||
6
.github/workflows/pr-opened-workflow.yml
vendored
6
.github/workflows/pr-opened-workflow.yml
vendored
@@ -18,3 +18,9 @@ jobs:
|
||||
- name: Add Assignee
|
||||
run: |
|
||||
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.pull_request.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'
|
||||
|
||||
- uses: actions/add-to-project@v0.4.0
|
||||
name: Add to Project Board
|
||||
with:
|
||||
project-url: https://github.com/orgs/actions/projects/12
|
||||
github-token: ${{ secrets.CACHE_BOARD_TOKEN }}
|
||||
|
||||
20
.github/workflows/publish-immutable-actions.yml
vendored
20
.github/workflows/publish-immutable-actions.yml
vendored
@@ -1,20 +0,0 @@
|
||||
name: 'Publish Immutable Action Version'
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checking out
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish
|
||||
id: publish
|
||||
uses: actions/publish-immutable-action@0.0.3
|
||||
@@ -13,10 +13,4 @@ allowed:
|
||||
|
||||
reviewed:
|
||||
npm:
|
||||
- sax
|
||||
- "@protobuf-ts/plugin-framework" # Apache-2.0
|
||||
- "@protobuf-ts/runtime" # Apache-2.0
|
||||
- fs.realpath # ISC
|
||||
- glob # ISC
|
||||
- prettier # MIT
|
||||
- lodash # MIT
|
||||
- sax
|
||||
BIN
.licenses/npm/@actions/cache.dep.yml
generated
BIN
.licenses/npm/@actions/cache.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/core.dep.yml
generated
BIN
.licenses/npm/@actions/core.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/http-client.dep.yml
generated
BIN
.licenses/npm/@actions/http-client.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/io.dep.yml
generated
BIN
.licenses/npm/@actions/io.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/core-http.dep.yml
generated
BIN
.licenses/npm/@azure/core-http.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/ms-rest-js.dep.yml
generated
BIN
.licenses/npm/@azure/ms-rest-js.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@protobuf-ts/runtime-rpc.dep.yml
generated
BIN
.licenses/npm/@protobuf-ts/runtime-rpc.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@protobuf-ts/runtime.dep.yml
generated
BIN
.licenses/npm/@protobuf-ts/runtime.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/brace-expansion.dep.yml
generated
BIN
.licenses/npm/brace-expansion.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/dunder-proto.dep.yml
generated
BIN
.licenses/npm/dunder-proto.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/es-define-property.dep.yml
generated
BIN
.licenses/npm/es-define-property.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/es-errors.dep.yml
generated
BIN
.licenses/npm/es-errors.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/es-object-atoms.dep.yml
generated
BIN
.licenses/npm/es-object-atoms.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/es-set-tostringtag.dep.yml
generated
BIN
.licenses/npm/es-set-tostringtag.dep.yml
generated
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/function-bind.dep.yml
generated
BIN
.licenses/npm/function-bind.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/get-intrinsic.dep.yml
generated
BIN
.licenses/npm/get-intrinsic.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/get-proto.dep.yml
generated
BIN
.licenses/npm/get-proto.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/gopd.dep.yml
generated
BIN
.licenses/npm/gopd.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/has-symbols.dep.yml
generated
BIN
.licenses/npm/has-symbols.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/has-tostringtag.dep.yml
generated
BIN
.licenses/npm/has-tostringtag.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/hasown.dep.yml
generated
BIN
.licenses/npm/hasown.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/math-intrinsics.dep.yml
generated
BIN
.licenses/npm/math-intrinsics.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/mime-db.dep.yml
generated
BIN
.licenses/npm/mime-db.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/mime-types.dep.yml
generated
BIN
.licenses/npm/mime-types.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/psl.dep.yml
generated
Normal file
BIN
.licenses/npm/psl.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/punycode.dep.yml
generated
Normal file
BIN
.licenses/npm/punycode.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/semver.dep.yml
generated
BIN
.licenses/npm/semver.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/tough-cookie.dep.yml
generated
Normal file
BIN
.licenses/npm/tough-cookie.dep.yml
generated
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/xml2js.dep.yml
generated
BIN
.licenses/npm/xml2js.dep.yml
generated
Binary file not shown.
18
README.md
18
README.md
@@ -3,7 +3,6 @@
|
||||
This action allows caching dependencies and build outputs to improve workflow execution time.
|
||||
|
||||
>Two other actions are available in addition to the primary `cache` action:
|
||||
>
|
||||
>* [Restore action](./restore/README.md)
|
||||
>* [Save action](./save/README.md)
|
||||
|
||||
@@ -15,25 +14,8 @@ See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/ac
|
||||
|
||||
## What's New
|
||||
|
||||
### ⚠️ Important changes
|
||||
|
||||
The cache backend service has been rewritten from the ground up for improved performance and reliability. [actions/cache](https://github.com/actions/cache) now integrates with the new cache service (v2) APIs.
|
||||
|
||||
The new service will gradually roll out as of **February 1st, 2025**. The legacy service will also be sunset on the same date. Changes in these release are **fully backward compatible**.
|
||||
|
||||
**We are deprecating some versions of this action**. We recommend upgrading to version `v4` or `v3` as soon as possible before **February 1st, 2025.** (Upgrade instructions below).
|
||||
|
||||
If you are using pinned SHAs, please use the SHAs of versions `v4.2.0` or `v3.4.0`
|
||||
|
||||
If you do not upgrade, all workflow runs using any of the deprecated [actions/cache](https://github.com/actions/cache) will fail.
|
||||
|
||||
Upgrading to the recommended versions will not break your workflows.
|
||||
|
||||
Read more about the change & access the migration guide: [reference to the announcement](https://github.com/actions/cache/discussions/1510).
|
||||
|
||||
### v3
|
||||
|
||||
* Integrated with the new cache service (v2) APIs.
|
||||
* Added support for caching in GHES 3.5+.
|
||||
* Fixed download issue for files > 2GB during restore.
|
||||
* Updated the minimum runner version support from node 12 -> node 16.
|
||||
|
||||
17
RELEASES.md
17
RELEASES.md
@@ -1,9 +1,5 @@
|
||||
# Releases
|
||||
|
||||
### 3.5.0
|
||||
|
||||
- Upgraded `@actions/cache` to v4.1.0 to integrate with the new cache service (v2) APIs & remove client side 10GiB cache size limit.
|
||||
|
||||
### 3.0.0
|
||||
|
||||
- Updated minimum runner version support from node 12 -> node 16
|
||||
@@ -111,16 +107,3 @@
|
||||
### 3.3.1
|
||||
|
||||
- Reduced segment size to 128MB and segment timeout to 10 minutes to fail fast in case the cache download is stuck.
|
||||
|
||||
### 3.3.2
|
||||
|
||||
- Fixes bug with Azure SDK causing blob downloads to get stuck.
|
||||
|
||||
### 3.3.3
|
||||
|
||||
- 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)
|
||||
- Additional audit fixes of npm package(s)
|
||||
|
||||
### 3.4.0
|
||||
|
||||
- Integrated with the new cache service (v2) APIs
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
|
||||
import * as core from "@actions/core";
|
||||
|
||||
import { Events, RefKey } from "../src/constants";
|
||||
import { restoreRun } from "../src/restoreImpl";
|
||||
import run from "../src/restore";
|
||||
import * as actionUtils from "../src/utils/actionUtils";
|
||||
import * as testUtils from "../src/utils/testUtils";
|
||||
|
||||
@@ -71,7 +71,7 @@ test("restore with no cache found", async () => {
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await restoreRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -114,7 +114,7 @@ test("restore with restore keys and no cache found", async () => {
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await restoreRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -156,7 +156,7 @@ test("restore with cache found for key", async () => {
|
||||
return Promise.resolve(key);
|
||||
});
|
||||
|
||||
await restoreRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -201,7 +201,7 @@ test("restore with cache found for restore key", async () => {
|
||||
return Promise.resolve(restoreKey);
|
||||
});
|
||||
|
||||
await restoreRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -246,7 +246,7 @@ test("Fail restore when fail on cache miss is enabled and primary + restore keys
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await restoreRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -289,7 +289,7 @@ test("restore when fail on cache miss is enabled and primary key doesn't match r
|
||||
return Promise.resolve(restoreKey);
|
||||
});
|
||||
|
||||
await restoreRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -335,7 +335,7 @@ test("restore with fail on cache miss disabled and no cache found", async () =>
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await restoreRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
|
||||
import * as core from "@actions/core";
|
||||
|
||||
import { Events, Inputs, RefKey } from "../src/constants";
|
||||
import { restoreImpl } from "../src/restoreImpl";
|
||||
import run from "../src/restoreImpl";
|
||||
import { StateProvider } from "../src/stateProvider";
|
||||
import * as actionUtils from "../src/utils/actionUtils";
|
||||
import * as testUtils from "../src/utils/testUtils";
|
||||
@@ -60,7 +60,7 @@ test("restore with invalid event outputs warning", async () => {
|
||||
const invalidEvent = "commit_comment";
|
||||
process.env[Events.Key] = invalidEvent;
|
||||
delete process.env[RefKey];
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
expect(logWarningMock).toHaveBeenCalledWith(
|
||||
`Event Validation Error: The event type ${invalidEvent} is not supported because it's not tied to a branch or tag ref.`
|
||||
);
|
||||
@@ -76,7 +76,7 @@ test("restore without AC available should no-op", async () => {
|
||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||
const setCacheHitOutputMock = jest.spyOn(core, "setOutput");
|
||||
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(0);
|
||||
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
||||
@@ -92,7 +92,7 @@ test("restore on GHES without AC available should no-op", async () => {
|
||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||
const setCacheHitOutputMock = jest.spyOn(core, "setOutput");
|
||||
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(0);
|
||||
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
||||
@@ -119,7 +119,7 @@ test("restore on GHES with AC available ", async () => {
|
||||
return Promise.resolve(key);
|
||||
});
|
||||
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -143,7 +143,7 @@ test("restore on GHES with AC available ", async () => {
|
||||
test("restore with no path should fail", async () => {
|
||||
const failedMock = jest.spyOn(core, "setFailed");
|
||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(0);
|
||||
// this input isn't necessary for restore b/c tarball contains entries relative to workspace
|
||||
expect(failedMock).not.toHaveBeenCalledWith(
|
||||
@@ -155,7 +155,7 @@ test("restore with no key", async () => {
|
||||
testUtils.setInput(Inputs.Path, "node_modules");
|
||||
const failedMock = jest.spyOn(core, "setFailed");
|
||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(0);
|
||||
expect(failedMock).toHaveBeenCalledWith(
|
||||
"Input required and not supplied: key"
|
||||
@@ -174,7 +174,7 @@ test("restore with too many keys should fail", async () => {
|
||||
});
|
||||
const failedMock = jest.spyOn(core, "setFailed");
|
||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
[path],
|
||||
@@ -200,7 +200,7 @@ test("restore with large key should fail", async () => {
|
||||
});
|
||||
const failedMock = jest.spyOn(core, "setFailed");
|
||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
[path],
|
||||
@@ -226,7 +226,7 @@ test("restore with invalid key should fail", async () => {
|
||||
});
|
||||
const failedMock = jest.spyOn(core, "setFailed");
|
||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
[path],
|
||||
@@ -260,7 +260,7 @@ test("restore with no cache found", async () => {
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -301,7 +301,7 @@ test("restore with restore keys and no cache found", async () => {
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -341,7 +341,7 @@ test("restore with cache found for key", async () => {
|
||||
return Promise.resolve(key);
|
||||
});
|
||||
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -383,7 +383,7 @@ test("restore with cache found for restore key", async () => {
|
||||
return Promise.resolve(restoreKey);
|
||||
});
|
||||
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -424,7 +424,7 @@ test("restore with lookup-only set", async () => {
|
||||
return Promise.resolve(key);
|
||||
});
|
||||
|
||||
await restoreImpl(new StateProvider());
|
||||
await run(new StateProvider());
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
|
||||
import * as core from "@actions/core";
|
||||
|
||||
import { Events, RefKey } from "../src/constants";
|
||||
import { restoreOnlyRun } from "../src/restoreImpl";
|
||||
import run from "../src/restoreOnly";
|
||||
import * as actionUtils from "../src/utils/actionUtils";
|
||||
import * as testUtils from "../src/utils/testUtils";
|
||||
|
||||
@@ -72,7 +72,7 @@ test("restore with no cache found", async () => {
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await restoreOnlyRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -114,7 +114,7 @@ test("restore with restore keys and no cache found", async () => {
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await restoreOnlyRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -153,7 +153,7 @@ test("restore with cache found for key", async () => {
|
||||
return Promise.resolve(key);
|
||||
});
|
||||
|
||||
await restoreOnlyRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
@@ -196,7 +196,7 @@ test("restore with cache found for restore key", async () => {
|
||||
return Promise.resolve(restoreKey);
|
||||
});
|
||||
|
||||
await restoreOnlyRun();
|
||||
await run();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
|
||||
63303
dist/restore-only/index.js
vendored
63303
dist/restore-only/index.js
vendored
File diff suppressed because one or more lines are too long
63347
dist/restore/index.js
vendored
63347
dist/restore/index.js
vendored
File diff suppressed because one or more lines are too long
63393
dist/save-only/index.js
vendored
63393
dist/save-only/index.js
vendored
File diff suppressed because one or more lines are too long
63335
dist/save/index.js
vendored
63335
dist/save/index.js
vendored
File diff suppressed because one or more lines are too long
1846
package-lock.json
generated
1846
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cache",
|
||||
"version": "3.5.0",
|
||||
"version": "3.3.1",
|
||||
"private": true,
|
||||
"description": "Cache dependencies and build outputs",
|
||||
"main": "dist/restore/index.js",
|
||||
@@ -23,10 +23,10 @@
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^4.1.0",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/cache": "^3.2.1",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.3"
|
||||
"@actions/io": "^1.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.5.2",
|
||||
@@ -34,7 +34,7 @@
|
||||
"@types/node": "^16.18.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||
"@typescript-eslint/parser": "^5.45.0",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"@zeit/ncc": "^0.20.5",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
@@ -48,4 +48,4 @@
|
||||
"ts-jest": "^28.0.8",
|
||||
"typescript": "^4.9.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
import { restoreRun } from "./restoreImpl";
|
||||
import restoreImpl from "./restoreImpl";
|
||||
import { StateProvider } from "./stateProvider";
|
||||
|
||||
restoreRun(true);
|
||||
async function run(): Promise<void> {
|
||||
await restoreImpl(new StateProvider());
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
export default run;
|
||||
|
||||
@@ -2,14 +2,10 @@ import * as cache from "@actions/cache";
|
||||
import * as core from "@actions/core";
|
||||
|
||||
import { Events, Inputs, Outputs, State } from "./constants";
|
||||
import {
|
||||
IStateProvider,
|
||||
NullStateProvider,
|
||||
StateProvider
|
||||
} from "./stateProvider";
|
||||
import { IStateProvider } from "./stateProvider";
|
||||
import * as utils from "./utils/actionUtils";
|
||||
|
||||
export async function restoreImpl(
|
||||
async function restoreImpl(
|
||||
stateProvider: IStateProvider
|
||||
): Promise<string | undefined> {
|
||||
try {
|
||||
@@ -86,37 +82,4 @@ export async function restoreImpl(
|
||||
}
|
||||
}
|
||||
|
||||
async function run(
|
||||
stateProvider: IStateProvider,
|
||||
earlyExit: boolean | undefined
|
||||
): Promise<void> {
|
||||
try {
|
||||
await restoreImpl(stateProvider);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
if (earlyExit) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// node will stay alive if any promises are not resolved,
|
||||
// which is a possibility if HTTP requests are dangling
|
||||
// due to retries or timeouts. We know that if we got here
|
||||
// that all promises that we care about have successfully
|
||||
// resolved, so simply exit with success.
|
||||
if (earlyExit) {
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
export async function restoreOnlyRun(
|
||||
earlyExit?: boolean | undefined
|
||||
): Promise<void> {
|
||||
await run(new NullStateProvider(), earlyExit);
|
||||
}
|
||||
|
||||
export async function restoreRun(
|
||||
earlyExit?: boolean | undefined
|
||||
): Promise<void> {
|
||||
await run(new StateProvider(), earlyExit);
|
||||
}
|
||||
export default restoreImpl;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
import { restoreOnlyRun } from "./restoreImpl";
|
||||
import restoreImpl from "./restoreImpl";
|
||||
import { NullStateProvider } from "./stateProvider";
|
||||
|
||||
restoreOnlyRun(true);
|
||||
async function run(): Promise<void> {
|
||||
await restoreImpl(new NullStateProvider());
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
export default run;
|
||||
|
||||
Reference in New Issue
Block a user