Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
robherley committed Jan 16, 2024
2 parents 1326563 + 65b8989 commit 53b35c5
Show file tree
Hide file tree
Showing 18 changed files with 218,868 additions and 220,936 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ jobs:
call-check-dist:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with:
node-version: "20.x"
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js 16.x
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.x
cache: npm
- run: npm ci
- name: Prettier Format Check
Expand Down
4 changes: 4 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,7 @@

- 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)

### 4.0.0

- Updated minimum runner version support from node 12 -> node 20
4 changes: 2 additions & 2 deletions __tests__/save.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
import * as core from "@actions/core";

import { Events, Inputs, RefKey } from "../src/constants";
import run from "../src/save";
import { saveRun } from "../src/saveImpl";
import * as actionUtils from "../src/utils/actionUtils";
import * as testUtils from "../src/utils/testUtils";

Expand Down Expand Up @@ -100,7 +100,7 @@ test("save with valid inputs uploads a cache", async () => {
return Promise.resolve(cacheId);
});

await run();
await saveRun();

expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
Expand Down
24 changes: 12 additions & 12 deletions __tests__/saveImpl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
import * as core from "@actions/core";

import { Events, Inputs, RefKey } from "../src/constants";
import run from "../src/saveImpl";
import { saveImpl } from "../src/saveImpl";
import { StateProvider } from "../src/stateProvider";
import * as actionUtils from "../src/utils/actionUtils";
import * as testUtils from "../src/utils/testUtils";
Expand Down Expand Up @@ -77,7 +77,7 @@ test("save with invalid event outputs warning", async () => {
const invalidEvent = "commit_comment";
process.env[Events.Key] = invalidEvent;
delete process.env[RefKey];
await run(new StateProvider());
await saveImpl(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.`
);
Expand All @@ -100,7 +100,7 @@ test("save with no primary key in state outputs warning", async () => {
});
const saveCacheMock = jest.spyOn(cache, "saveCache");

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(0);
expect(logWarningMock).toHaveBeenCalledWith(`Key is not specified.`);
Expand All @@ -115,7 +115,7 @@ test("save without AC available should no-op", async () => {

const saveCacheMock = jest.spyOn(cache, "saveCache");

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(0);
});
Expand All @@ -128,7 +128,7 @@ test("save on ghes without AC available should no-op", async () => {

const saveCacheMock = jest.spyOn(cache, "saveCache");

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(0);
});
Expand Down Expand Up @@ -161,7 +161,7 @@ test("save on GHES with AC available", async () => {
return Promise.resolve(cacheId);
});

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
Expand Down Expand Up @@ -194,7 +194,7 @@ test("save with exact match returns early", async () => {
});
const saveCacheMock = jest.spyOn(cache, "saveCache");

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(0);
expect(infoMock).toHaveBeenCalledWith(
Expand All @@ -221,7 +221,7 @@ test("save with missing input outputs warning", async () => {
});
const saveCacheMock = jest.spyOn(cache, "saveCache");

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(0);
expect(logWarningMock).toHaveBeenCalledWith(
Expand Down Expand Up @@ -259,7 +259,7 @@ test("save with large cache outputs warning", async () => {
);
});

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
Expand Down Expand Up @@ -306,7 +306,7 @@ test("save with reserve cache failure outputs warning", async () => {
throw error;
});

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
Expand Down Expand Up @@ -349,7 +349,7 @@ test("save with server error outputs warning", async () => {
throw new Error("HTTP Error Occurred");
});

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
Expand Down Expand Up @@ -392,7 +392,7 @@ test("save with valid inputs uploads a cache", async () => {
return Promise.resolve(cacheId);
});

await run(new StateProvider());
await saveImpl(new StateProvider());

expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
Expand Down
6 changes: 3 additions & 3 deletions __tests__/saveOnly.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
import * as core from "@actions/core";

import { Events, Inputs, RefKey } from "../src/constants";
import run from "../src/saveOnly";
import { saveOnlyRun } from "../src/saveImpl";
import * as actionUtils from "../src/utils/actionUtils";
import * as testUtils from "../src/utils/testUtils";

Expand Down Expand Up @@ -90,7 +90,7 @@ test("save with valid inputs uploads a cache", async () => {
return Promise.resolve(cacheId);
});

await run();
await saveOnlyRun();

expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
Expand Down Expand Up @@ -122,7 +122,7 @@ test("save failing logs the warning message", async () => {
return Promise.resolve(cacheId);
});

await run();
await saveOnlyRun();

expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith(
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'
runs:
using: 'node16'
using: 'node20'
main: 'dist/restore/index.js'
post: 'dist/save/index.js'
post-if: "success() || github.event.inputs.save-always"
Expand Down

0 comments on commit 53b35c5

Please sign in to comment.