Skip to content

Commit c1b1466

Browse files
azuretekCopilot
andauthored
Update GitHub Action runtime from Node 20 to Node 24 (#52)
* Update GitHub Action runtime from Node 20 to Node 24 Node 20 is deprecated on GitHub Actions runners. This updates the action runtime, dev dependencies (TypeScript 5, @types/node 24, jest 29, ts-jest 29), and fixes TypeScript strict catch clause typing. * Update package.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Use instanceof Error narrowing in test catch clauses Replace unsafe type assertions with idiomatic runtime checks for execSync error handling in e2e tests. * Update package-lock.json for @types/node ^24.0.0 * Bump CI actions to Node 24 compatible versions actions/checkout v4 → v6, actions/setup-node v4 → v6. Both v4 versions run on Node 20; v6 runs on Node 24, matching our target runtime. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 93a1637 commit c1b1466

7 files changed

Lines changed: 4294 additions & 6350 deletions

File tree

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: checkout
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v6
15+
- name: setup node
16+
uses: actions/setup-node@v6
17+
with:
18+
node-version: 24
1519
- name: build and test
1620
run: |
1721
npm install
@@ -23,7 +27,7 @@ jobs:
2327
runs-on: ubuntu-latest
2428
steps:
2529
- name: checkout
26-
uses: actions/checkout@v4
30+
uses: actions/checkout@v6
2731
- name: Datadog
2832
uses: ./
2933
with:

__tests__/main.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ describe('end-to-end tests', () => {
159159
try {
160160
console.log(cp.execSync(`node ${ip}`, options).toString())
161161
} catch (e) {
162-
console.log(e.output.toString())
162+
if (e instanceof Error) {
163+
console.log(e.message)
164+
}
163165
throw e
164166
}
165167
})
@@ -190,7 +192,9 @@ describe('end-to-end tests', () => {
190192
try {
191193
console.log(cp.execSync(`node ${ip}`, options).toString())
192194
} catch (e) {
193-
console.log(e.output.toString())
195+
if (e instanceof Error) {
196+
console.log(e.message)
197+
}
194198
throw e
195199
}
196200
})

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ inputs:
3232
required: false
3333
default: '30000'
3434
runs:
35-
using: 'node20'
35+
using: 'node24'
3636
main: 'dist/index.js'
3737
branding:
3838
icon: 'bar-chart-2'

dist/index.js

Lines changed: 73 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88

99
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1010
if (k2 === undefined) k2 = k;
11-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11+
var desc = Object.getOwnPropertyDescriptor(m, k);
12+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13+
desc = { enumerable: true, get: function() { return m[k]; } };
14+
}
15+
Object.defineProperty(o, k2, desc);
1216
}) : (function(o, m, k, k2) {
1317
if (k2 === undefined) k2 = k;
1418
o[k2] = m[k];
@@ -18,13 +22,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
1822
}) : function(o, v) {
1923
o["default"] = v;
2024
});
21-
var __importStar = (this && this.__importStar) || function (mod) {
22-
if (mod && mod.__esModule) return mod;
23-
var result = {};
24-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25-
__setModuleDefault(result, mod);
26-
return result;
27-
};
25+
var __importStar = (this && this.__importStar) || (function () {
26+
var ownKeys = function(o) {
27+
ownKeys = Object.getOwnPropertyNames || function (o) {
28+
var ar = [];
29+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30+
return ar;
31+
};
32+
return ownKeys(o);
33+
};
34+
return function (mod) {
35+
if (mod && mod.__esModule) return mod;
36+
var result = {};
37+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38+
__setModuleDefault(result, mod);
39+
return result;
40+
};
41+
})();
2842
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2943
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3044
return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +49,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3549
});
3650
};
3751
Object.defineProperty(exports, "__esModule", ({ value: true }));
38-
exports.sendLogs = exports.sendServiceChecks = exports.sendEvents = exports.sendMetrics = exports.getClient = void 0;
52+
exports.getClient = getClient;
53+
exports.sendMetrics = sendMetrics;
54+
exports.sendEvents = sendEvents;
55+
exports.sendServiceChecks = sendServiceChecks;
56+
exports.sendLogs = sendLogs;
3957
const core = __importStar(__nccwpck_require__(2186));
4058
const httpm = __importStar(__nccwpck_require__(9925));
4159
function getClient(apiKey, timeout) {
@@ -47,7 +65,6 @@ function getClient(apiKey, timeout) {
4765
socketTimeout: timeout
4866
});
4967
}
50-
exports.getClient = getClient;
5168
function isTimeoutError(error) {
5269
// force the error into a string so it both works for Error instances and plain strings
5370
const error_msg = `${error}`;
@@ -99,7 +116,6 @@ function sendMetrics(apiURL, apiKey, metrics, ignoreTimeouts, timeout) {
99116
yield postMetricsIfAny(http, apiURL, distributions, 'v1/distribution_points', ignoreTimeouts);
100117
});
101118
}
102-
exports.sendMetrics = sendMetrics;
103119
function sendEvents(apiURL, apiKey, events, ignoreTimeouts, timeout) {
104120
return __awaiter(this, void 0, void 0, function* () {
105121
const http = getClient(apiKey, timeout);
@@ -127,7 +143,6 @@ function sendEvents(apiURL, apiKey, events, ignoreTimeouts, timeout) {
127143
}
128144
});
129145
}
130-
exports.sendEvents = sendEvents;
131146
function sendServiceChecks(apiURL, apiKey, serviceChecks, ignoreTimeouts, timeout) {
132147
return __awaiter(this, void 0, void 0, function* () {
133148
const http = getClient(apiKey, timeout);
@@ -155,7 +170,6 @@ function sendServiceChecks(apiURL, apiKey, serviceChecks, ignoreTimeouts, timeou
155170
}
156171
});
157172
}
158-
exports.sendServiceChecks = sendServiceChecks;
159173
function sendLogs(logApiURL, apiKey, logs, ignoreTimeouts, timeout) {
160174
return __awaiter(this, void 0, void 0, function* () {
161175
const http = getClient(apiKey, timeout);
@@ -184,7 +198,6 @@ function sendLogs(logApiURL, apiKey, logs, ignoreTimeouts, timeout) {
184198
}
185199
});
186200
}
187-
exports.sendLogs = sendLogs;
188201

189202

190203
/***/ }),
@@ -196,7 +209,11 @@ exports.sendLogs = sendLogs;
196209

197210
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
198211
if (k2 === undefined) k2 = k;
199-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
212+
var desc = Object.getOwnPropertyDescriptor(m, k);
213+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
214+
desc = { enumerable: true, get: function() { return m[k]; } };
215+
}
216+
Object.defineProperty(o, k2, desc);
200217
}) : (function(o, m, k, k2) {
201218
if (k2 === undefined) k2 = k;
202219
o[k2] = m[k];
@@ -206,17 +223,27 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
206223
}) : function(o, v) {
207224
o["default"] = v;
208225
});
209-
var __importStar = (this && this.__importStar) || function (mod) {
210-
if (mod && mod.__esModule) return mod;
211-
var result = {};
212-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
213-
__setModuleDefault(result, mod);
214-
return result;
215-
};
226+
var __importStar = (this && this.__importStar) || (function () {
227+
var ownKeys = function(o) {
228+
ownKeys = Object.getOwnPropertyNames || function (o) {
229+
var ar = [];
230+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
231+
return ar;
232+
};
233+
return ownKeys(o);
234+
};
235+
return function (mod) {
236+
if (mod && mod.__esModule) return mod;
237+
var result = {};
238+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
239+
__setModuleDefault(result, mod);
240+
return result;
241+
};
242+
})();
216243
Object.defineProperty(exports, "__esModule", ({ value: true }));
217244
const core = __importStar(__nccwpck_require__(2186));
218245
const run_1 = __nccwpck_require__(7884);
219-
run_1.run()
246+
(0, run_1.run)()
220247
.catch(err => {
221248
core.setFailed(err.message);
222249
process.exit(1);
@@ -235,7 +262,11 @@ run_1.run()
235262

236263
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
237264
if (k2 === undefined) k2 = k;
238-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
265+
var desc = Object.getOwnPropertyDescriptor(m, k);
266+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
267+
desc = { enumerable: true, get: function() { return m[k]; } };
268+
}
269+
Object.defineProperty(o, k2, desc);
239270
}) : (function(o, m, k, k2) {
240271
if (k2 === undefined) k2 = k;
241272
o[k2] = m[k];
@@ -245,13 +276,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
245276
}) : function(o, v) {
246277
o["default"] = v;
247278
});
248-
var __importStar = (this && this.__importStar) || function (mod) {
249-
if (mod && mod.__esModule) return mod;
250-
var result = {};
251-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
252-
__setModuleDefault(result, mod);
253-
return result;
254-
};
279+
var __importStar = (this && this.__importStar) || (function () {
280+
var ownKeys = function(o) {
281+
ownKeys = Object.getOwnPropertyNames || function (o) {
282+
var ar = [];
283+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
284+
return ar;
285+
};
286+
return ownKeys(o);
287+
};
288+
return function (mod) {
289+
if (mod && mod.__esModule) return mod;
290+
var result = {};
291+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
292+
__setModuleDefault(result, mod);
293+
return result;
294+
};
295+
})();
255296
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
256297
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
257298
return new (P || (P = Promise))(function (resolve, reject) {
@@ -262,7 +303,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
262303
});
263304
};
264305
Object.defineProperty(exports, "__esModule", ({ value: true }));
265-
exports.run = void 0;
306+
exports.run = run;
266307
const core = __importStar(__nccwpck_require__(2186));
267308
const yaml = __importStar(__nccwpck_require__(1917));
268309
const dd = __importStar(__nccwpck_require__(1401));
@@ -283,7 +324,6 @@ function run() {
283324
yield dd.sendLogs(logApiURL, apiKey, logs, ignoreTimeouts, timeout);
284325
});
285326
}
286-
exports.run = run;
287327

288328

289329
/***/ }),

0 commit comments

Comments
 (0)