Skip to content

Commit d8d1a10

Browse files
committed
chore: build dist
1 parent 3a5ea56 commit d8d1a10

File tree

1 file changed

+147
-29
lines changed

1 file changed

+147
-29
lines changed

dist/index.js

Lines changed: 147 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,32 @@ module.exports = onetime(() => {
958958
});
959959

960960

961+
/***/ }),
962+
963+
/***/ 82:
964+
/***/ (function(__unusedmodule, exports) {
965+
966+
"use strict";
967+
968+
// We use any as a valid input type
969+
/* eslint-disable @typescript-eslint/no-explicit-any */
970+
Object.defineProperty(exports, "__esModule", { value: true });
971+
/**
972+
* Sanitizes an input into a string so it can be passed into issueCommand safely
973+
* @param input input to sanitize into a string
974+
*/
975+
function toCommandValue(input) {
976+
if (input === null || input === undefined) {
977+
return '';
978+
}
979+
else if (typeof input === 'string' || input instanceof String) {
980+
return input;
981+
}
982+
return JSON.stringify(input);
983+
}
984+
exports.toCommandValue = toCommandValue;
985+
//# sourceMappingURL=utils.js.map
986+
961987
/***/ }),
962988

963989
/***/ 84:
@@ -1136,6 +1162,42 @@ module.exports = stripAnsi;
11361162
module.exports.default = stripAnsi;
11371163

11381164

1165+
/***/ }),
1166+
1167+
/***/ 102:
1168+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
1169+
1170+
"use strict";
1171+
1172+
// For internal use, subject to change.
1173+
var __importStar = (this && this.__importStar) || function (mod) {
1174+
if (mod && mod.__esModule) return mod;
1175+
var result = {};
1176+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
1177+
result["default"] = mod;
1178+
return result;
1179+
};
1180+
Object.defineProperty(exports, "__esModule", { value: true });
1181+
// We use any as a valid input type
1182+
/* eslint-disable @typescript-eslint/no-explicit-any */
1183+
const fs = __importStar(__webpack_require__(747));
1184+
const os = __importStar(__webpack_require__(87));
1185+
const utils_1 = __webpack_require__(82);
1186+
function issueCommand(command, message) {
1187+
const filePath = process.env[`GITHUB_${command}`];
1188+
if (!filePath) {
1189+
throw new Error(`Unable to find environment variable for file command ${command}`);
1190+
}
1191+
if (!fs.existsSync(filePath)) {
1192+
throw new Error(`Missing file at path: ${filePath}`);
1193+
}
1194+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
1195+
encoding: 'utf8'
1196+
});
1197+
}
1198+
exports.issueCommand = issueCommand;
1199+
//# sourceMappingURL=file-command.js.map
1200+
11391201
/***/ }),
11401202

11411203
/***/ 129:
@@ -4281,17 +4343,25 @@ Promise.prototype.get = function (propertyName) {
42814343

42824344
"use strict";
42834345

4346+
var __importStar = (this && this.__importStar) || function (mod) {
4347+
if (mod && mod.__esModule) return mod;
4348+
var result = {};
4349+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
4350+
result["default"] = mod;
4351+
return result;
4352+
};
42844353
Object.defineProperty(exports, "__esModule", { value: true });
4285-
const os = __webpack_require__(87);
4354+
const os = __importStar(__webpack_require__(87));
4355+
const utils_1 = __webpack_require__(82);
42864356
/**
42874357
* Commands
42884358
*
42894359
* Command Format:
4290-
* ##[name key=value;key=value]message
4360+
* ::name key=value,key=value::message
42914361
*
42924362
* Examples:
4293-
* ##[warning]This is the user warning message
4294-
* ##[set-secret name=mypassword]definitelyNotAPassword!
4363+
* ::warning::This is the message
4364+
* ::set-env name=MY_VAR::some value
42954365
*/
42964366
function issueCommand(command, properties, message) {
42974367
const cmd = new Command(command, properties, message);
@@ -4316,34 +4386,39 @@ class Command {
43164386
let cmdStr = CMD_STRING + this.command;
43174387
if (this.properties && Object.keys(this.properties).length > 0) {
43184388
cmdStr += ' ';
4389+
let first = true;
43194390
for (const key in this.properties) {
43204391
if (this.properties.hasOwnProperty(key)) {
43214392
const val = this.properties[key];
43224393
if (val) {
4323-
// safely append the val - avoid blowing up when attempting to
4324-
// call .replace() if message is not a string for some reason
4325-
cmdStr += `${key}=${escape(`${val || ''}`)},`;
4394+
if (first) {
4395+
first = false;
4396+
}
4397+
else {
4398+
cmdStr += ',';
4399+
}
4400+
cmdStr += `${key}=${escapeProperty(val)}`;
43264401
}
43274402
}
43284403
}
43294404
}
4330-
cmdStr += CMD_STRING;
4331-
// safely append the message - avoid blowing up when attempting to
4332-
// call .replace() if message is not a string for some reason
4333-
const message = `${this.message || ''}`;
4334-
cmdStr += escapeData(message);
4405+
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
43354406
return cmdStr;
43364407
}
43374408
}
43384409
function escapeData(s) {
4339-
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
4410+
return utils_1.toCommandValue(s)
4411+
.replace(/%/g, '%25')
4412+
.replace(/\r/g, '%0D')
4413+
.replace(/\n/g, '%0A');
43404414
}
4341-
function escape(s) {
4342-
return s
4415+
function escapeProperty(s) {
4416+
return utils_1.toCommandValue(s)
4417+
.replace(/%/g, '%25')
43434418
.replace(/\r/g, '%0D')
43444419
.replace(/\n/g, '%0A')
4345-
.replace(/]/g, '%5D')
4346-
.replace(/;/g, '%3B');
4420+
.replace(/:/g, '%3A')
4421+
.replace(/,/g, '%2C');
43474422
}
43484423
//# sourceMappingURL=command.js.map
43494424

@@ -4493,10 +4568,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
44934568
step((generator = generator.apply(thisArg, _arguments || [])).next());
44944569
});
44954570
};
4571+
var __importStar = (this && this.__importStar) || function (mod) {
4572+
if (mod && mod.__esModule) return mod;
4573+
var result = {};
4574+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
4575+
result["default"] = mod;
4576+
return result;
4577+
};
44964578
Object.defineProperty(exports, "__esModule", { value: true });
44974579
const command_1 = __webpack_require__(431);
4498-
const os = __webpack_require__(87);
4499-
const path = __webpack_require__(622);
4580+
const file_command_1 = __webpack_require__(102);
4581+
const utils_1 = __webpack_require__(82);
4582+
const os = __importStar(__webpack_require__(87));
4583+
const path = __importStar(__webpack_require__(622));
45004584
/**
45014585
* The code to exit an action
45024586
*/
@@ -4517,11 +4601,21 @@ var ExitCode;
45174601
/**
45184602
* Sets env variable for this action and future actions in the job
45194603
* @param name the name of the variable to set
4520-
* @param val the value of the variable
4604+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
45214605
*/
4606+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
45224607
function exportVariable(name, val) {
4523-
process.env[name] = val;
4524-
command_1.issueCommand('set-env', { name }, val);
4608+
const convertedVal = utils_1.toCommandValue(val);
4609+
process.env[name] = convertedVal;
4610+
const filePath = process.env['GITHUB_ENV'] || '';
4611+
if (filePath) {
4612+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
4613+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
4614+
file_command_1.issueCommand('ENV', commandValue);
4615+
}
4616+
else {
4617+
command_1.issueCommand('set-env', { name }, convertedVal);
4618+
}
45254619
}
45264620
exports.exportVariable = exportVariable;
45274621
/**
@@ -4537,7 +4631,13 @@ exports.setSecret = setSecret;
45374631
* @param inputPath
45384632
*/
45394633
function addPath(inputPath) {
4540-
command_1.issueCommand('add-path', {}, inputPath);
4634+
const filePath = process.env['GITHUB_PATH'] || '';
4635+
if (filePath) {
4636+
file_command_1.issueCommand('PATH', inputPath);
4637+
}
4638+
else {
4639+
command_1.issueCommand('add-path', {}, inputPath);
4640+
}
45414641
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
45424642
}
45434643
exports.addPath = addPath;
@@ -4560,12 +4660,22 @@ exports.getInput = getInput;
45604660
* Sets the value of an output.
45614661
*
45624662
* @param name name of the output to set
4563-
* @param value value to store
4663+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
45644664
*/
4665+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
45654666
function setOutput(name, value) {
45664667
command_1.issueCommand('set-output', { name }, value);
45674668
}
45684669
exports.setOutput = setOutput;
4670+
/**
4671+
* Enables or disables the echoing of commands into stdout for the rest of the step.
4672+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
4673+
*
4674+
*/
4675+
function setCommandEcho(enabled) {
4676+
command_1.issue('echo', enabled ? 'on' : 'off');
4677+
}
4678+
exports.setCommandEcho = setCommandEcho;
45694679
//-----------------------------------------------------------------------
45704680
// Results
45714681
//-----------------------------------------------------------------------
@@ -4582,6 +4692,13 @@ exports.setFailed = setFailed;
45824692
//-----------------------------------------------------------------------
45834693
// Logging Commands
45844694
//-----------------------------------------------------------------------
4695+
/**
4696+
* Gets whether Actions Step Debug is on or not
4697+
*/
4698+
function isDebug() {
4699+
return process.env['RUNNER_DEBUG'] === '1';
4700+
}
4701+
exports.isDebug = isDebug;
45854702
/**
45864703
* Writes debug message to user log
45874704
* @param message debug message
@@ -4592,18 +4709,18 @@ function debug(message) {
45924709
exports.debug = debug;
45934710
/**
45944711
* Adds an error issue
4595-
* @param message error issue message
4712+
* @param message error issue message. Errors will be converted to string via toString()
45964713
*/
45974714
function error(message) {
4598-
command_1.issue('error', message);
4715+
command_1.issue('error', message instanceof Error ? message.toString() : message);
45994716
}
46004717
exports.error = error;
46014718
/**
46024719
* Adds an warning issue
4603-
* @param message warning issue message
4720+
* @param message warning issue message. Errors will be converted to string via toString()
46044721
*/
46054722
function warning(message) {
4606-
command_1.issue('warning', message);
4723+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
46074724
}
46084725
exports.warning = warning;
46094726
/**
@@ -4661,8 +4778,9 @@ exports.group = group;
46614778
* Saves state for current action, the state can only be retrieved by this action's post job execution.
46624779
*
46634780
* @param name name of the state to store
4664-
* @param value value to store
4781+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
46654782
*/
4783+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
46664784
function saveState(name, value) {
46674785
command_1.issueCommand('save-state', { name }, value);
46684786
}

0 commit comments

Comments
 (0)