Skip to content

Commit 633666f

Browse files
authored
Merge pull request #247 from hashicorp/dependabot/npm_and_yarn/actions/core-1.10.0
Bump @actions/core from 1.9.1 to 1.10.0
2 parents b3bda2d + 73d00bf commit 633666f

File tree

6 files changed

+88
-58
lines changed

6 files changed

+88
-58
lines changed

dist/index.js

+36-21
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ const file_command_1 = __nccwpck_require__(717);
309309
const utils_1 = __nccwpck_require__(5278);
310310
const os = __importStar(__nccwpck_require__(2037));
311311
const path = __importStar(__nccwpck_require__(1017));
312-
const uuid_1 = __nccwpck_require__(8974);
313312
const oidc_utils_1 = __nccwpck_require__(8041);
314313
/**
315314
* The code to exit an action
@@ -339,20 +338,9 @@ function exportVariable(name, val) {
339338
process.env[name] = convertedVal;
340339
const filePath = process.env['GITHUB_ENV'] || '';
341340
if (filePath) {
342-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
343-
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
344-
if (name.includes(delimiter)) {
345-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
346-
}
347-
if (convertedVal.includes(delimiter)) {
348-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
349-
}
350-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
351-
file_command_1.issueCommand('ENV', commandValue);
352-
}
353-
else {
354-
command_1.issueCommand('set-env', { name }, convertedVal);
341+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
355342
}
343+
command_1.issueCommand('set-env', { name }, convertedVal);
356344
}
357345
exports.exportVariable = exportVariable;
358346
/**
@@ -370,7 +358,7 @@ exports.setSecret = setSecret;
370358
function addPath(inputPath) {
371359
const filePath = process.env['GITHUB_PATH'] || '';
372360
if (filePath) {
373-
file_command_1.issueCommand('PATH', inputPath);
361+
file_command_1.issueFileCommand('PATH', inputPath);
374362
}
375363
else {
376364
command_1.issueCommand('add-path', {}, inputPath);
@@ -410,7 +398,10 @@ function getMultilineInput(name, options) {
410398
const inputs = getInput(name, options)
411399
.split('\n')
412400
.filter(x => x !== '');
413-
return inputs;
401+
if (options && options.trimWhitespace === false) {
402+
return inputs;
403+
}
404+
return inputs.map(input => input.trim());
414405
}
415406
exports.getMultilineInput = getMultilineInput;
416407
/**
@@ -443,8 +434,12 @@ exports.getBooleanInput = getBooleanInput;
443434
*/
444435
// eslint-disable-next-line @typescript-eslint/no-explicit-any
445436
function setOutput(name, value) {
437+
const filePath = process.env['GITHUB_OUTPUT'] || '';
438+
if (filePath) {
439+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
440+
}
446441
process.stdout.write(os.EOL);
447-
command_1.issueCommand('set-output', { name }, value);
442+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
448443
}
449444
exports.setOutput = setOutput;
450445
/**
@@ -573,7 +568,11 @@ exports.group = group;
573568
*/
574569
// eslint-disable-next-line @typescript-eslint/no-explicit-any
575570
function saveState(name, value) {
576-
command_1.issueCommand('save-state', { name }, value);
571+
const filePath = process.env['GITHUB_STATE'] || '';
572+
if (filePath) {
573+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
574+
}
575+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
577576
}
578577
exports.saveState = saveState;
579578
/**
@@ -639,13 +638,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
639638
return result;
640639
};
641640
Object.defineProperty(exports, "__esModule", ({ value: true }));
642-
exports.issueCommand = void 0;
641+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
643642
// We use any as a valid input type
644643
/* eslint-disable @typescript-eslint/no-explicit-any */
645644
const fs = __importStar(__nccwpck_require__(7147));
646645
const os = __importStar(__nccwpck_require__(2037));
646+
const uuid_1 = __nccwpck_require__(8974);
647647
const utils_1 = __nccwpck_require__(5278);
648-
function issueCommand(command, message) {
648+
function issueFileCommand(command, message) {
649649
const filePath = process.env[`GITHUB_${command}`];
650650
if (!filePath) {
651651
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -657,7 +657,22 @@ function issueCommand(command, message) {
657657
encoding: 'utf8'
658658
});
659659
}
660-
exports.issueCommand = issueCommand;
660+
exports.issueFileCommand = issueFileCommand;
661+
function prepareKeyValueMessage(key, value) {
662+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
663+
const convertedValue = utils_1.toCommandValue(value);
664+
// These should realistically never happen, but just in case someone finds a
665+
// way to exploit uuid generation let's not allow keys or values that contain
666+
// the delimiter.
667+
if (key.includes(delimiter)) {
668+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
669+
}
670+
if (convertedValue.includes(delimiter)) {
671+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
672+
}
673+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
674+
}
675+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
661676
//# sourceMappingURL=file-command.js.map
662677

663678
/***/ }),

dist/index1.js

+36-21
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ const file_command_1 = __nccwpck_require__(717);
200200
const utils_1 = __nccwpck_require__(278);
201201
const os = __importStar(__nccwpck_require__(37));
202202
const path = __importStar(__nccwpck_require__(17));
203-
const uuid_1 = __nccwpck_require__(840);
204203
const oidc_utils_1 = __nccwpck_require__(41);
205204
/**
206205
* The code to exit an action
@@ -230,20 +229,9 @@ function exportVariable(name, val) {
230229
process.env[name] = convertedVal;
231230
const filePath = process.env['GITHUB_ENV'] || '';
232231
if (filePath) {
233-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
234-
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
235-
if (name.includes(delimiter)) {
236-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
237-
}
238-
if (convertedVal.includes(delimiter)) {
239-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
240-
}
241-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
242-
file_command_1.issueCommand('ENV', commandValue);
243-
}
244-
else {
245-
command_1.issueCommand('set-env', { name }, convertedVal);
232+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
246233
}
234+
command_1.issueCommand('set-env', { name }, convertedVal);
247235
}
248236
exports.exportVariable = exportVariable;
249237
/**
@@ -261,7 +249,7 @@ exports.setSecret = setSecret;
261249
function addPath(inputPath) {
262250
const filePath = process.env['GITHUB_PATH'] || '';
263251
if (filePath) {
264-
file_command_1.issueCommand('PATH', inputPath);
252+
file_command_1.issueFileCommand('PATH', inputPath);
265253
}
266254
else {
267255
command_1.issueCommand('add-path', {}, inputPath);
@@ -301,7 +289,10 @@ function getMultilineInput(name, options) {
301289
const inputs = getInput(name, options)
302290
.split('\n')
303291
.filter(x => x !== '');
304-
return inputs;
292+
if (options && options.trimWhitespace === false) {
293+
return inputs;
294+
}
295+
return inputs.map(input => input.trim());
305296
}
306297
exports.getMultilineInput = getMultilineInput;
307298
/**
@@ -334,8 +325,12 @@ exports.getBooleanInput = getBooleanInput;
334325
*/
335326
// eslint-disable-next-line @typescript-eslint/no-explicit-any
336327
function setOutput(name, value) {
328+
const filePath = process.env['GITHUB_OUTPUT'] || '';
329+
if (filePath) {
330+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
331+
}
337332
process.stdout.write(os.EOL);
338-
command_1.issueCommand('set-output', { name }, value);
333+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
339334
}
340335
exports.setOutput = setOutput;
341336
/**
@@ -464,7 +459,11 @@ exports.group = group;
464459
*/
465460
// eslint-disable-next-line @typescript-eslint/no-explicit-any
466461
function saveState(name, value) {
467-
command_1.issueCommand('save-state', { name }, value);
462+
const filePath = process.env['GITHUB_STATE'] || '';
463+
if (filePath) {
464+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
465+
}
466+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
468467
}
469468
exports.saveState = saveState;
470469
/**
@@ -530,13 +529,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
530529
return result;
531530
};
532531
Object.defineProperty(exports, "__esModule", ({ value: true }));
533-
exports.issueCommand = void 0;
532+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
534533
// We use any as a valid input type
535534
/* eslint-disable @typescript-eslint/no-explicit-any */
536535
const fs = __importStar(__nccwpck_require__(147));
537536
const os = __importStar(__nccwpck_require__(37));
537+
const uuid_1 = __nccwpck_require__(840);
538538
const utils_1 = __nccwpck_require__(278);
539-
function issueCommand(command, message) {
539+
function issueFileCommand(command, message) {
540540
const filePath = process.env[`GITHUB_${command}`];
541541
if (!filePath) {
542542
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -548,7 +548,22 @@ function issueCommand(command, message) {
548548
encoding: 'utf8'
549549
});
550550
}
551-
exports.issueCommand = issueCommand;
551+
exports.issueFileCommand = issueFileCommand;
552+
function prepareKeyValueMessage(key, value) {
553+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
554+
const convertedValue = utils_1.toCommandValue(value);
555+
// These should realistically never happen, but just in case someone finds a
556+
// way to exploit uuid generation let's not allow keys or values that contain
557+
// the delimiter.
558+
if (key.includes(delimiter)) {
559+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
560+
}
561+
if (convertedValue.includes(delimiter)) {
562+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
563+
}
564+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
565+
}
566+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
552567
//# sourceMappingURL=file-command.js.map
553568

554569
/***/ }),

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"keywords": [],
2020
"author": "",
2121
"dependencies": {
22-
"@actions/core": "^1.9.1",
22+
"@actions/core": "^1.10.0",
2323
"@actions/github": "^5.1.1",
2424
"@actions/io": "^1.1.2",
2525
"@actions/tool-cache": "^2.0.1",

wrapper/package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wrapper/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"author": "",
1414
"dependencies": {
15-
"@actions/core": "^1.9.1",
15+
"@actions/core": "^1.10.0",
1616
"@actions/exec": "^1.1.0",
1717
"@actions/io": "^1.1.1"
1818
},

0 commit comments

Comments
 (0)