Skip to content

Commit 17150a8

Browse files
build(deps): bump @actions/core from 1.2.0 to 1.2.6 (#1)
1 parent 8c88503 commit 17150a8

File tree

3 files changed

+152
-34
lines changed

3 files changed

+152
-34
lines changed

dist/index.js

Lines changed: 147 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,75 @@ module.exports =
4343
/************************************************************************/
4444
/******/ ({
4545

46+
/***/ 82:
47+
/***/ (function(__unusedmodule, exports) {
48+
49+
"use strict";
50+
51+
// We use any as a valid input type
52+
/* eslint-disable @typescript-eslint/no-explicit-any */
53+
Object.defineProperty(exports, "__esModule", { value: true });
54+
/**
55+
* Sanitizes an input into a string so it can be passed into issueCommand safely
56+
* @param input input to sanitize into a string
57+
*/
58+
function toCommandValue(input) {
59+
if (input === null || input === undefined) {
60+
return '';
61+
}
62+
else if (typeof input === 'string' || input instanceof String) {
63+
return input;
64+
}
65+
return JSON.stringify(input);
66+
}
67+
exports.toCommandValue = toCommandValue;
68+
//# sourceMappingURL=utils.js.map
69+
70+
/***/ }),
71+
4672
/***/ 87:
4773
/***/ (function(module) {
4874

4975
module.exports = require("os");
5076

5177
/***/ }),
5278

79+
/***/ 102:
80+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
81+
82+
"use strict";
83+
84+
// For internal use, subject to change.
85+
var __importStar = (this && this.__importStar) || function (mod) {
86+
if (mod && mod.__esModule) return mod;
87+
var result = {};
88+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
89+
result["default"] = mod;
90+
return result;
91+
};
92+
Object.defineProperty(exports, "__esModule", { value: true });
93+
// We use any as a valid input type
94+
/* eslint-disable @typescript-eslint/no-explicit-any */
95+
const fs = __importStar(__webpack_require__(747));
96+
const os = __importStar(__webpack_require__(87));
97+
const utils_1 = __webpack_require__(82);
98+
function issueCommand(command, message) {
99+
const filePath = process.env[`GITHUB_${command}`];
100+
if (!filePath) {
101+
throw new Error(`Unable to find environment variable for file command ${command}`);
102+
}
103+
if (!fs.existsSync(filePath)) {
104+
throw new Error(`Missing file at path: ${filePath}`);
105+
}
106+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
107+
encoding: 'utf8'
108+
});
109+
}
110+
exports.issueCommand = issueCommand;
111+
//# sourceMappingURL=file-command.js.map
112+
113+
/***/ }),
114+
53115
/***/ 104:
54116
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
55117

@@ -81,17 +143,25 @@ run();
81143

82144
"use strict";
83145

146+
var __importStar = (this && this.__importStar) || function (mod) {
147+
if (mod && mod.__esModule) return mod;
148+
var result = {};
149+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
150+
result["default"] = mod;
151+
return result;
152+
};
84153
Object.defineProperty(exports, "__esModule", { value: true });
85-
const os = __webpack_require__(87);
154+
const os = __importStar(__webpack_require__(87));
155+
const utils_1 = __webpack_require__(82);
86156
/**
87157
* Commands
88158
*
89159
* Command Format:
90-
* ##[name key=value;key=value]message
160+
* ::name key=value,key=value::message
91161
*
92162
* Examples:
93-
* ##[warning]This is the user warning message
94-
* ##[set-secret name=mypassword]definitelyNotAPassword!
163+
* ::warning::This is the message
164+
* ::set-env name=MY_VAR::some value
95165
*/
96166
function issueCommand(command, properties, message) {
97167
const cmd = new Command(command, properties, message);
@@ -116,34 +186,39 @@ class Command {
116186
let cmdStr = CMD_STRING + this.command;
117187
if (this.properties && Object.keys(this.properties).length > 0) {
118188
cmdStr += ' ';
189+
let first = true;
119190
for (const key in this.properties) {
120191
if (this.properties.hasOwnProperty(key)) {
121192
const val = this.properties[key];
122193
if (val) {
123-
// safely append the val - avoid blowing up when attempting to
124-
// call .replace() if message is not a string for some reason
125-
cmdStr += `${key}=${escape(`${val || ''}`)},`;
194+
if (first) {
195+
first = false;
196+
}
197+
else {
198+
cmdStr += ',';
199+
}
200+
cmdStr += `${key}=${escapeProperty(val)}`;
126201
}
127202
}
128203
}
129204
}
130-
cmdStr += CMD_STRING;
131-
// safely append the message - avoid blowing up when attempting to
132-
// call .replace() if message is not a string for some reason
133-
const message = `${this.message || ''}`;
134-
cmdStr += escapeData(message);
205+
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
135206
return cmdStr;
136207
}
137208
}
138209
function escapeData(s) {
139-
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
210+
return utils_1.toCommandValue(s)
211+
.replace(/%/g, '%25')
212+
.replace(/\r/g, '%0D')
213+
.replace(/\n/g, '%0A');
140214
}
141-
function escape(s) {
142-
return s
215+
function escapeProperty(s) {
216+
return utils_1.toCommandValue(s)
217+
.replace(/%/g, '%25')
143218
.replace(/\r/g, '%0D')
144219
.replace(/\n/g, '%0A')
145-
.replace(/]/g, '%5D')
146-
.replace(/;/g, '%3B');
220+
.replace(/:/g, '%3A')
221+
.replace(/,/g, '%2C');
147222
}
148223
//# sourceMappingURL=command.js.map
149224

@@ -163,10 +238,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
163238
step((generator = generator.apply(thisArg, _arguments || [])).next());
164239
});
165240
};
241+
var __importStar = (this && this.__importStar) || function (mod) {
242+
if (mod && mod.__esModule) return mod;
243+
var result = {};
244+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
245+
result["default"] = mod;
246+
return result;
247+
};
166248
Object.defineProperty(exports, "__esModule", { value: true });
167249
const command_1 = __webpack_require__(431);
168-
const os = __webpack_require__(87);
169-
const path = __webpack_require__(622);
250+
const file_command_1 = __webpack_require__(102);
251+
const utils_1 = __webpack_require__(82);
252+
const os = __importStar(__webpack_require__(87));
253+
const path = __importStar(__webpack_require__(622));
170254
/**
171255
* The code to exit an action
172256
*/
@@ -187,11 +271,21 @@ var ExitCode;
187271
/**
188272
* Sets env variable for this action and future actions in the job
189273
* @param name the name of the variable to set
190-
* @param val the value of the variable
274+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
191275
*/
276+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
192277
function exportVariable(name, val) {
193-
process.env[name] = val;
194-
command_1.issueCommand('set-env', { name }, val);
278+
const convertedVal = utils_1.toCommandValue(val);
279+
process.env[name] = convertedVal;
280+
const filePath = process.env['GITHUB_ENV'] || '';
281+
if (filePath) {
282+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
283+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
284+
file_command_1.issueCommand('ENV', commandValue);
285+
}
286+
else {
287+
command_1.issueCommand('set-env', { name }, convertedVal);
288+
}
195289
}
196290
exports.exportVariable = exportVariable;
197291
/**
@@ -207,7 +301,13 @@ exports.setSecret = setSecret;
207301
* @param inputPath
208302
*/
209303
function addPath(inputPath) {
210-
command_1.issueCommand('add-path', {}, inputPath);
304+
const filePath = process.env['GITHUB_PATH'] || '';
305+
if (filePath) {
306+
file_command_1.issueCommand('PATH', inputPath);
307+
}
308+
else {
309+
command_1.issueCommand('add-path', {}, inputPath);
310+
}
211311
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
212312
}
213313
exports.addPath = addPath;
@@ -230,12 +330,22 @@ exports.getInput = getInput;
230330
* Sets the value of an output.
231331
*
232332
* @param name name of the output to set
233-
* @param value value to store
333+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
234334
*/
335+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
235336
function setOutput(name, value) {
236337
command_1.issueCommand('set-output', { name }, value);
237338
}
238339
exports.setOutput = setOutput;
340+
/**
341+
* Enables or disables the echoing of commands into stdout for the rest of the step.
342+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
343+
*
344+
*/
345+
function setCommandEcho(enabled) {
346+
command_1.issue('echo', enabled ? 'on' : 'off');
347+
}
348+
exports.setCommandEcho = setCommandEcho;
239349
//-----------------------------------------------------------------------
240350
// Results
241351
//-----------------------------------------------------------------------
@@ -252,6 +362,13 @@ exports.setFailed = setFailed;
252362
//-----------------------------------------------------------------------
253363
// Logging Commands
254364
//-----------------------------------------------------------------------
365+
/**
366+
* Gets whether Actions Step Debug is on or not
367+
*/
368+
function isDebug() {
369+
return process.env['RUNNER_DEBUG'] === '1';
370+
}
371+
exports.isDebug = isDebug;
255372
/**
256373
* Writes debug message to user log
257374
* @param message debug message
@@ -262,18 +379,18 @@ function debug(message) {
262379
exports.debug = debug;
263380
/**
264381
* Adds an error issue
265-
* @param message error issue message
382+
* @param message error issue message. Errors will be converted to string via toString()
266383
*/
267384
function error(message) {
268-
command_1.issue('error', message);
385+
command_1.issue('error', message instanceof Error ? message.toString() : message);
269386
}
270387
exports.error = error;
271388
/**
272389
* Adds an warning issue
273-
* @param message warning issue message
390+
* @param message warning issue message. Errors will be converted to string via toString()
274391
*/
275392
function warning(message) {
276-
command_1.issue('warning', message);
393+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
277394
}
278395
exports.warning = warning;
279396
/**
@@ -331,8 +448,9 @@ exports.group = group;
331448
* Saves state for current action, the state can only be retrieved by this action's post job execution.
332449
*
333450
* @param name name of the state to store
334-
* @param value value to store
451+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
335452
*/
453+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
336454
function saveState(name, value) {
337455
command_1.issueCommand('save-state', { name }, value);
338456
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build": "ncc build index.js"
1010
},
1111
"dependencies": {
12-
"@actions/core": "^1.2.0"
12+
"@actions/core": "^1.2.6"
1313
},
1414
"devDependencies": {
1515
"@zeit/ncc": "^0.20.5"

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.0":
6-
version "1.2.0"
7-
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.0.tgz#aa5f52b26c362c821d41557e599371a42f6c0b3d"
8-
integrity sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw==
5+
"@actions/core@^1.2.6":
6+
version "1.2.6"
7+
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09"
8+
integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==
99

1010
"@zeit/ncc@^0.20.5":
1111
version "0.20.5"

0 commit comments

Comments
 (0)