Skip to content

Commit 376d8eb

Browse files
committed
@actions/core to 1.2.4, correct version info placement
1 parent 03698dc commit 376d8eb

File tree

6 files changed

+54
-23
lines changed

6 files changed

+54
-23
lines changed

dist/index.js

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,13 @@ var ExitCode;
215215
/**
216216
* Sets env variable for this action and future actions in the job
217217
* @param name the name of the variable to set
218-
* @param val the value of the variable
218+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
219219
*/
220+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
220221
function exportVariable(name, val) {
221-
process.env[name] = val;
222-
command_1.issueCommand('set-env', { name }, val);
222+
const convertedVal = command_1.toCommandValue(val);
223+
process.env[name] = convertedVal;
224+
command_1.issueCommand('set-env', { name }, convertedVal);
223225
}
224226
exports.exportVariable = exportVariable;
225227
/**
@@ -258,12 +260,22 @@ exports.getInput = getInput;
258260
* Sets the value of an output.
259261
*
260262
* @param name name of the output to set
261-
* @param value value to store
263+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
262264
*/
265+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
263266
function setOutput(name, value) {
264267
command_1.issueCommand('set-output', { name }, value);
265268
}
266269
exports.setOutput = setOutput;
270+
/**
271+
* Enables or disables the echoing of commands into stdout for the rest of the step.
272+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
273+
*
274+
*/
275+
function setCommandEcho(enabled) {
276+
command_1.issue('echo', enabled ? 'on' : 'off');
277+
}
278+
exports.setCommandEcho = setCommandEcho;
267279
//-----------------------------------------------------------------------
268280
// Results
269281
//-----------------------------------------------------------------------
@@ -297,18 +309,18 @@ function debug(message) {
297309
exports.debug = debug;
298310
/**
299311
* Adds an error issue
300-
* @param message error issue message
312+
* @param message error issue message. Errors will be converted to string via toString()
301313
*/
302314
function error(message) {
303-
command_1.issue('error', message);
315+
command_1.issue('error', message instanceof Error ? message.toString() : message);
304316
}
305317
exports.error = error;
306318
/**
307319
* Adds an warning issue
308-
* @param message warning issue message
320+
* @param message warning issue message. Errors will be converted to string via toString()
309321
*/
310322
function warning(message) {
311-
command_1.issue('warning', message);
323+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
312324
}
313325
exports.warning = warning;
314326
/**
@@ -366,8 +378,9 @@ exports.group = group;
366378
* Saves state for current action, the state can only be retrieved by this action's post job execution.
367379
*
368380
* @param name name of the state to store
369-
* @param value value to store
381+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
370382
*/
383+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
371384
function saveState(name, value) {
372385
command_1.issueCommand('save-state', { name }, value);
373386
}
@@ -601,8 +614,8 @@ const openssl = async () => {
601614
execSync(`pacman.exe -R --noconfirm --noprogressbar ${pre.trim()}openssl`)
602615
execSync(`pacman.exe -Udd --noconfirm --noprogressbar ${fn}`)
603616
grpEnd(msSt)
617+
mingw = mingw.replace(/\bopenssl\b/gi, '').trim()
604618
}
605-
mingw = mingw.replace(/\bopenssl\b/gi, '').trim()
606619
}
607620

608621
// Updates MSYS2 MinGW gcc items
@@ -811,14 +824,28 @@ class Command {
811824
return cmdStr;
812825
}
813826
}
827+
/**
828+
* Sanitizes an input into a string so it can be passed into issueCommand safely
829+
* @param input input to sanitize into a string
830+
*/
831+
function toCommandValue(input) {
832+
if (input === null || input === undefined) {
833+
return '';
834+
}
835+
else if (typeof input === 'string' || input instanceof String) {
836+
return input;
837+
}
838+
return JSON.stringify(input);
839+
}
840+
exports.toCommandValue = toCommandValue;
814841
function escapeData(s) {
815-
return (s || '')
842+
return toCommandValue(s)
816843
.replace(/%/g, '%25')
817844
.replace(/\r/g, '%0D')
818845
.replace(/\n/g, '%0A');
819846
}
820847
function escapeProperty(s) {
821-
return (s || '')
848+
return toCommandValue(s)
822849
.replace(/%/g, '%25')
823850
.replace(/\r/g, '%0D')
824851
.replace(/\n/g, '%0A')
@@ -1724,14 +1751,16 @@ module.exports = require("fs");
17241751

17251752
if (core.getInput('ruby-version') !== '') {
17261753
const fn = `${process.env.RUNNER_TEMP}\\setup_ruby.js`
1727-
common.log(` Running ruby/setup-ruby ${common.version}`)
1754+
common.log(' Running ruby/setup-ruby')
17281755
const msSt = performance.now()
17291756
await common.download('https://raw.githubusercontent.com/ruby/setup-ruby/v1/dist/index.js', fn, false)
17301757
await require(fn).run()
17311758
const timeStr = ((performance.now() - msSt)/1000).toFixed(2).padStart(6)
17321759
console.log(` took ${timeStr} s`)
17331760
}
17341761

1762+
common.log(` Running MSP-Greg/setup-ruby-pkgs ${common.version}`)
1763+
17351764
let runner
17361765

17371766
core.exportVariable('TMPDIR', process.env.RUNNER_TEMP)

dist/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-ruby-pkgs",
3-
"version": "1.6.0",
3+
"version": "1.7.0",
44
"description": "Install packages and update builds tools for Ruby",
55
"main": "index.js",
66
"scripts": {
@@ -22,7 +22,7 @@
2222
"author": "MSP-Greg",
2323
"license": "MIT",
2424
"dependencies": {
25-
"@actions/core": "^1.2.3",
25+
"@actions/core": "^1.2.4",
2626
"@actions/http-client": "^1.0.8"
2727
}
2828
}

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@
2929

3030
if (core.getInput('ruby-version') !== '') {
3131
const fn = `${process.env.RUNNER_TEMP}\\setup_ruby.js`
32-
common.log(` Running ruby/setup-ruby ${common.version}`)
32+
common.log(' Running ruby/setup-ruby')
3333
const msSt = performance.now()
3434
await common.download('https://raw.githubusercontent.com/ruby/setup-ruby/v1/dist/index.js', fn, false)
3535
await require(fn).run()
3636
const timeStr = ((performance.now() - msSt)/1000).toFixed(2).padStart(6)
3737
console.log(` took ${timeStr} s`)
3838
}
3939

40+
common.log(` Running MSP-Greg/setup-ruby-pkgs ${common.version}`)
41+
4042
let runner
4143

4244
core.exportVariable('TMPDIR', process.env.RUNNER_TEMP)

mingw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ const openssl = async () => {
8383
execSync(`pacman.exe -R --noconfirm --noprogressbar ${pre.trim()}openssl`)
8484
execSync(`pacman.exe -Udd --noconfirm --noprogressbar ${fn}`)
8585
grpEnd(msSt)
86+
mingw = mingw.replace(/\bopenssl\b/gi, '').trim()
8687
}
87-
mingw = mingw.replace(/\bopenssl\b/gi, '').trim()
8888
}
8989

9090
// Updates MSYS2 MinGW gcc items

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-ruby-pkgs",
3-
"version": "1.6.0",
3+
"version": "1.7.0",
44
"description": "Install packages and update builds tools for Ruby",
55
"main": "index.js",
66
"scripts": {
@@ -22,7 +22,7 @@
2222
"author": "MSP-Greg",
2323
"license": "MIT",
2424
"dependencies": {
25-
"@actions/core": "^1.2.3",
25+
"@actions/core": "^1.2.4",
2626
"@actions/http-client": "^1.0.8"
2727
}
2828
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# yarn lockfile v1
33

44

5-
"@actions/core@^1.2.3":
6-
version "1.2.3"
7-
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.3.tgz#e844b4fa0820e206075445079130868f95bfca95"
8-
integrity sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w==
5+
"@actions/core@^1.2.4":
6+
version "1.2.4"
7+
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.4.tgz#96179dbf9f8d951dd74b40a0dbd5c22555d186ab"
8+
integrity sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==
99

1010
"@actions/http-client@^1.0.8":
1111
version "1.0.8"

0 commit comments

Comments
 (0)