Skip to content

Commit c031f4d

Browse files
authored
Merge pull request #14 from peter-evans/update-distribution
Update distribution
2 parents 39cc38d + 4bc718f commit c031f4d

File tree

1 file changed

+87
-64
lines changed

1 file changed

+87
-64
lines changed

dist/index.js

Lines changed: 87 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,7 +2297,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
22972297
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
22982298

22992299
var isPlainObject = _interopDefault(__webpack_require__(696));
2300-
var universalUserAgent = __webpack_require__(562);
2300+
var universalUserAgent = __webpack_require__(796);
23012301

23022302
function lowercaseKeys(object) {
23032303
if (!object) {
@@ -2647,7 +2647,7 @@ function withDefaults(oldDefaults, newDefaults) {
26472647
});
26482648
}
26492649

2650-
const VERSION = "5.5.3";
2650+
const VERSION = "6.0.1";
26512651

26522652
const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url.
26532653
// So we use RequestParameters and add method as additional required property.
@@ -2772,17 +2772,24 @@ function errname(uv, code) {
27722772

27732773
"use strict";
27742774

2775+
var __importStar = (this && this.__importStar) || function (mod) {
2776+
if (mod && mod.__esModule) return mod;
2777+
var result = {};
2778+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
2779+
result["default"] = mod;
2780+
return result;
2781+
};
27752782
Object.defineProperty(exports, "__esModule", { value: true });
2776-
const os = __webpack_require__(87);
2783+
const os = __importStar(__webpack_require__(87));
27772784
/**
27782785
* Commands
27792786
*
27802787
* Command Format:
2781-
* ##[name key=value;key=value]message
2788+
* ::name key=value,key=value::message
27822789
*
27832790
* Examples:
2784-
* ##[warning]This is the user warning message
2785-
* ##[set-secret name=mypassword]definitelyNotAPassword!
2791+
* ::warning::This is the message
2792+
* ::set-env name=MY_VAR::some value
27862793
*/
27872794
function issueCommand(command, properties, message) {
27882795
const cmd = new Command(command, properties, message);
@@ -2807,34 +2814,53 @@ class Command {
28072814
let cmdStr = CMD_STRING + this.command;
28082815
if (this.properties && Object.keys(this.properties).length > 0) {
28092816
cmdStr += ' ';
2817+
let first = true;
28102818
for (const key in this.properties) {
28112819
if (this.properties.hasOwnProperty(key)) {
28122820
const val = this.properties[key];
28132821
if (val) {
2814-
// safely append the val - avoid blowing up when attempting to
2815-
// call .replace() if message is not a string for some reason
2816-
cmdStr += `${key}=${escape(`${val || ''}`)},`;
2822+
if (first) {
2823+
first = false;
2824+
}
2825+
else {
2826+
cmdStr += ',';
2827+
}
2828+
cmdStr += `${key}=${escapeProperty(val)}`;
28172829
}
28182830
}
28192831
}
28202832
}
2821-
cmdStr += CMD_STRING;
2822-
// safely append the message - avoid blowing up when attempting to
2823-
// call .replace() if message is not a string for some reason
2824-
const message = `${this.message || ''}`;
2825-
cmdStr += escapeData(message);
2833+
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
28262834
return cmdStr;
28272835
}
28282836
}
2837+
/**
2838+
* Sanitizes an input into a string so it can be passed into issueCommand safely
2839+
* @param input input to sanitize into a string
2840+
*/
2841+
function toCommandValue(input) {
2842+
if (input === null || input === undefined) {
2843+
return '';
2844+
}
2845+
else if (typeof input === 'string' || input instanceof String) {
2846+
return input;
2847+
}
2848+
return JSON.stringify(input);
2849+
}
2850+
exports.toCommandValue = toCommandValue;
28292851
function escapeData(s) {
2830-
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
2852+
return toCommandValue(s)
2853+
.replace(/%/g, '%25')
2854+
.replace(/\r/g, '%0D')
2855+
.replace(/\n/g, '%0A');
28312856
}
2832-
function escape(s) {
2833-
return s
2857+
function escapeProperty(s) {
2858+
return toCommandValue(s)
2859+
.replace(/%/g, '%25')
28342860
.replace(/\r/g, '%0D')
28352861
.replace(/\n/g, '%0A')
2836-
.replace(/]/g, '%5D')
2837-
.replace(/;/g, '%3B');
2862+
.replace(/:/g, '%3A')
2863+
.replace(/,/g, '%2C');
28382864
}
28392865
//# sourceMappingURL=command.js.map
28402866

@@ -4709,10 +4735,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
47094735
step((generator = generator.apply(thisArg, _arguments || [])).next());
47104736
});
47114737
};
4738+
var __importStar = (this && this.__importStar) || function (mod) {
4739+
if (mod && mod.__esModule) return mod;
4740+
var result = {};
4741+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
4742+
result["default"] = mod;
4743+
return result;
4744+
};
47124745
Object.defineProperty(exports, "__esModule", { value: true });
47134746
const command_1 = __webpack_require__(431);
4714-
const os = __webpack_require__(87);
4715-
const path = __webpack_require__(622);
4747+
const os = __importStar(__webpack_require__(87));
4748+
const path = __importStar(__webpack_require__(622));
47164749
/**
47174750
* The code to exit an action
47184751
*/
@@ -4733,11 +4766,13 @@ var ExitCode;
47334766
/**
47344767
* Sets env variable for this action and future actions in the job
47354768
* @param name the name of the variable to set
4736-
* @param val the value of the variable
4769+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
47374770
*/
4771+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
47384772
function exportVariable(name, val) {
4739-
process.env[name] = val;
4740-
command_1.issueCommand('set-env', { name }, val);
4773+
const convertedVal = command_1.toCommandValue(val);
4774+
process.env[name] = convertedVal;
4775+
command_1.issueCommand('set-env', { name }, convertedVal);
47414776
}
47424777
exports.exportVariable = exportVariable;
47434778
/**
@@ -4776,12 +4811,22 @@ exports.getInput = getInput;
47764811
* Sets the value of an output.
47774812
*
47784813
* @param name name of the output to set
4779-
* @param value value to store
4814+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
47804815
*/
4816+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
47814817
function setOutput(name, value) {
47824818
command_1.issueCommand('set-output', { name }, value);
47834819
}
47844820
exports.setOutput = setOutput;
4821+
/**
4822+
* Enables or disables the echoing of commands into stdout for the rest of the step.
4823+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
4824+
*
4825+
*/
4826+
function setCommandEcho(enabled) {
4827+
command_1.issue('echo', enabled ? 'on' : 'off');
4828+
}
4829+
exports.setCommandEcho = setCommandEcho;
47854830
//-----------------------------------------------------------------------
47864831
// Results
47874832
//-----------------------------------------------------------------------
@@ -4798,6 +4843,13 @@ exports.setFailed = setFailed;
47984843
//-----------------------------------------------------------------------
47994844
// Logging Commands
48004845
//-----------------------------------------------------------------------
4846+
/**
4847+
* Gets whether Actions Step Debug is on or not
4848+
*/
4849+
function isDebug() {
4850+
return process.env['RUNNER_DEBUG'] === '1';
4851+
}
4852+
exports.isDebug = isDebug;
48014853
/**
48024854
* Writes debug message to user log
48034855
* @param message debug message
@@ -4808,18 +4860,18 @@ function debug(message) {
48084860
exports.debug = debug;
48094861
/**
48104862
* Adds an error issue
4811-
* @param message error issue message
4863+
* @param message error issue message. Errors will be converted to string via toString()
48124864
*/
48134865
function error(message) {
4814-
command_1.issue('error', message);
4866+
command_1.issue('error', message instanceof Error ? message.toString() : message);
48154867
}
48164868
exports.error = error;
48174869
/**
48184870
* Adds an warning issue
4819-
* @param message warning issue message
4871+
* @param message warning issue message. Errors will be converted to string via toString()
48204872
*/
48214873
function warning(message) {
4822-
command_1.issue('warning', message);
4874+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
48234875
}
48244876
exports.warning = warning;
48254877
/**
@@ -4877,8 +4929,9 @@ exports.group = group;
48774929
* Saves state for current action, the state can only be retrieved by this action's post job execution.
48784930
*
48794931
* @param name name of the state to store
4880-
* @param value value to store
4932+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
48814933
*/
4934+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
48824935
function saveState(name, value) {
48834936
command_1.issueCommand('save-state', { name }, value);
48844937
}
@@ -4950,36 +5003,6 @@ function resolveCommand(parsed) {
49505003
module.exports = resolveCommand;
49515004

49525005

4953-
/***/ }),
4954-
4955-
/***/ 562:
4956-
/***/ (function(__unusedmodule, exports, __webpack_require__) {
4957-
4958-
"use strict";
4959-
4960-
4961-
Object.defineProperty(exports, '__esModule', { value: true });
4962-
4963-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4964-
4965-
var osName = _interopDefault(__webpack_require__(2));
4966-
4967-
function getUserAgent() {
4968-
try {
4969-
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
4970-
} catch (error) {
4971-
if (/wmic os get Caption/.test(error.message)) {
4972-
return "Windows <version undetectable>";
4973-
}
4974-
4975-
return "<environment undetectable>";
4976-
}
4977-
}
4978-
4979-
exports.getUserAgent = getUserAgent;
4980-
//# sourceMappingURL=index.js.map
4981-
4982-
49835006
/***/ }),
49845007

49855008
/***/ 568:
@@ -5487,7 +5510,7 @@ var isPlainObject = _interopDefault(__webpack_require__(696));
54875510
var nodeFetch = _interopDefault(__webpack_require__(454));
54885511
var requestError = __webpack_require__(463);
54895512

5490-
const VERSION = "5.2.1";
5513+
const VERSION = "5.4.2";
54915514

54925515
function getBufferResponse(response) {
54935516
return response.arrayBuffer();
@@ -5517,7 +5540,7 @@ function fetchWrapper(requestOptions) {
55175540

55185541
if (status === 204 || status === 205) {
55195542
return;
5520-
} // GitHub API returns 200 for HEAD requsets
5543+
} // GitHub API returns 200 for HEAD requests
55215544

55225545

55235546
if (requestOptions.method === "HEAD") {
@@ -5548,7 +5571,7 @@ function fetchWrapper(requestOptions) {
55485571
try {
55495572
let responseBody = JSON.parse(error.message);
55505573
Object.assign(error, responseBody);
5551-
let errors = responseBody.errors; // Assumption `errors` would always be in Array Fotmat
5574+
let errors = responseBody.errors; // Assumption `errors` would always be in Array format
55525575

55535576
error.message = error.message + ": " + errors.map(JSON.stringify).join(", ");
55545577
} catch (e) {// ignore, see octokit/rest.js#684
@@ -5677,7 +5700,7 @@ function getUserAgent() {
56775700
return "Windows <version undetectable>";
56785701
}
56795702

5680-
throw error;
5703+
return "<environment undetectable>";
56815704
}
56825705
}
56835706

0 commit comments

Comments
 (0)