Skip to content

Commit 65b8989

Browse files
authoredJan 16, 2024
Merge pull request #1284 from takost/update-to-node-20
Update action to node20
2 parents e12d46a + d0be34d commit 65b8989

18 files changed

+218868
-220936
lines changed
 

‎.github/workflows/check-dist.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ jobs:
1515
call-check-dist:
1616
name: Check dist/
1717
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
18+
with:
19+
node-version: "20.x"

‎.github/workflows/workflow.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
steps:
2222
- name: Checkout
2323
uses: actions/checkout@v3
24-
- name: Setup Node.js 16.x
24+
- name: Setup Node.js 20.x
2525
uses: actions/setup-node@v3
2626
with:
27-
node-version: 16.x
27+
node-version: 20.x
2828
cache: npm
2929
- run: npm ci
3030
- name: Prettier Format Check

‎RELEASES.md

+4
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,7 @@
116116

117117
- 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)
118118
- Additional audit fixes of npm package(s)
119+
120+
### 4.0.0
121+
122+
- Updated minimum runner version support from node 12 -> node 20

‎__tests__/save.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
22
import * as core from "@actions/core";
33

44
import { Events, Inputs, RefKey } from "../src/constants";
5-
import run from "../src/save";
5+
import { saveRun } from "../src/saveImpl";
66
import * as actionUtils from "../src/utils/actionUtils";
77
import * as testUtils from "../src/utils/testUtils";
88

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

103-
await run();
103+
await saveRun();
104104

105105
expect(saveCacheMock).toHaveBeenCalledTimes(1);
106106
expect(saveCacheMock).toHaveBeenCalledWith(

‎__tests__/saveImpl.test.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
22
import * as core from "@actions/core";
33

44
import { Events, Inputs, RefKey } from "../src/constants";
5-
import run from "../src/saveImpl";
5+
import { saveImpl } from "../src/saveImpl";
66
import { StateProvider } from "../src/stateProvider";
77
import * as actionUtils from "../src/utils/actionUtils";
88
import * as testUtils from "../src/utils/testUtils";
@@ -77,7 +77,7 @@ test("save with invalid event outputs warning", async () => {
7777
const invalidEvent = "commit_comment";
7878
process.env[Events.Key] = invalidEvent;
7979
delete process.env[RefKey];
80-
await run(new StateProvider());
80+
await saveImpl(new StateProvider());
8181
expect(logWarningMock).toHaveBeenCalledWith(
8282
`Event Validation Error: The event type ${invalidEvent} is not supported because it's not tied to a branch or tag ref.`
8383
);
@@ -100,7 +100,7 @@ test("save with no primary key in state outputs warning", async () => {
100100
});
101101
const saveCacheMock = jest.spyOn(cache, "saveCache");
102102

103-
await run(new StateProvider());
103+
await saveImpl(new StateProvider());
104104

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

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

118-
await run(new StateProvider());
118+
await saveImpl(new StateProvider());
119119

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

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

131-
await run(new StateProvider());
131+
await saveImpl(new StateProvider());
132132

133133
expect(saveCacheMock).toHaveBeenCalledTimes(0);
134134
});
@@ -161,7 +161,7 @@ test("save on GHES with AC available", async () => {
161161
return Promise.resolve(cacheId);
162162
});
163163

164-
await run(new StateProvider());
164+
await saveImpl(new StateProvider());
165165

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

197-
await run(new StateProvider());
197+
await saveImpl(new StateProvider());
198198

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

224-
await run(new StateProvider());
224+
await saveImpl(new StateProvider());
225225

226226
expect(saveCacheMock).toHaveBeenCalledTimes(0);
227227
expect(logWarningMock).toHaveBeenCalledWith(
@@ -259,7 +259,7 @@ test("save with large cache outputs warning", async () => {
259259
);
260260
});
261261

262-
await run(new StateProvider());
262+
await saveImpl(new StateProvider());
263263

264264
expect(saveCacheMock).toHaveBeenCalledTimes(1);
265265
expect(saveCacheMock).toHaveBeenCalledWith(
@@ -306,7 +306,7 @@ test("save with reserve cache failure outputs warning", async () => {
306306
throw error;
307307
});
308308

309-
await run(new StateProvider());
309+
await saveImpl(new StateProvider());
310310

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

352-
await run(new StateProvider());
352+
await saveImpl(new StateProvider());
353353

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

395-
await run(new StateProvider());
395+
await saveImpl(new StateProvider());
396396

397397
expect(saveCacheMock).toHaveBeenCalledTimes(1);
398398
expect(saveCacheMock).toHaveBeenCalledWith(

‎__tests__/saveOnly.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
22
import * as core from "@actions/core";
33

44
import { Events, Inputs, RefKey } from "../src/constants";
5-
import run from "../src/saveOnly";
5+
import { saveOnlyRun } from "../src/saveImpl";
66
import * as actionUtils from "../src/utils/actionUtils";
77
import * as testUtils from "../src/utils/testUtils";
88

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

93-
await run();
93+
await saveOnlyRun();
9494

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

125-
await run();
125+
await saveOnlyRun();
126126

127127
expect(saveCacheMock).toHaveBeenCalledTimes(1);
128128
expect(saveCacheMock).toHaveBeenCalledWith(

‎action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ outputs:
3030
cache-hit:
3131
description: 'A boolean value to indicate an exact match was found for the primary key'
3232
runs:
33-
using: 'node16'
33+
using: 'node20'
3434
main: 'dist/restore/index.js'
3535
post: 'dist/save/index.js'
3636
post-if: success()

0 commit comments

Comments
 (0)