Skip to content

Commit c26a08b

Browse files
committed
Updating actions core toolkit
1 parent 6a8fede commit c26a08b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+9322
-30
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dependency directory
2-
node_modules
2+
# node_modules
33

44
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
55
# Logs

dist/index.js

Lines changed: 147 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -934,13 +934,75 @@ class ExecState extends events.EventEmitter {
934934

935935
/***/ }),
936936

937+
/***/ 82:
938+
/***/ (function(__unusedmodule, exports) {
939+
940+
"use strict";
941+
942+
// We use any as a valid input type
943+
/* eslint-disable @typescript-eslint/no-explicit-any */
944+
Object.defineProperty(exports, "__esModule", { value: true });
945+
/**
946+
* Sanitizes an input into a string so it can be passed into issueCommand safely
947+
* @param input input to sanitize into a string
948+
*/
949+
function toCommandValue(input) {
950+
if (input === null || input === undefined) {
951+
return '';
952+
}
953+
else if (typeof input === 'string' || input instanceof String) {
954+
return input;
955+
}
956+
return JSON.stringify(input);
957+
}
958+
exports.toCommandValue = toCommandValue;
959+
//# sourceMappingURL=utils.js.map
960+
961+
/***/ }),
962+
937963
/***/ 87:
938964
/***/ (function(module) {
939965

940966
module.exports = require("os");
941967

942968
/***/ }),
943969

970+
/***/ 102:
971+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
972+
973+
"use strict";
974+
975+
// For internal use, subject to change.
976+
var __importStar = (this && this.__importStar) || function (mod) {
977+
if (mod && mod.__esModule) return mod;
978+
var result = {};
979+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
980+
result["default"] = mod;
981+
return result;
982+
};
983+
Object.defineProperty(exports, "__esModule", { value: true });
984+
// We use any as a valid input type
985+
/* eslint-disable @typescript-eslint/no-explicit-any */
986+
const fs = __importStar(__webpack_require__(747));
987+
const os = __importStar(__webpack_require__(87));
988+
const utils_1 = __webpack_require__(82);
989+
function issueCommand(command, message) {
990+
const filePath = process.env[`GITHUB_${command}`];
991+
if (!filePath) {
992+
throw new Error(`Unable to find environment variable for file command ${command}`);
993+
}
994+
if (!fs.existsSync(filePath)) {
995+
throw new Error(`Missing file at path: ${filePath}`);
996+
}
997+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
998+
encoding: 'utf8'
999+
});
1000+
}
1001+
exports.issueCommand = issueCommand;
1002+
//# sourceMappingURL=file-command.js.map
1003+
1004+
/***/ }),
1005+
9441006
/***/ 129:
9451007
/***/ (function(module) {
9461008

@@ -1071,17 +1133,25 @@ module.exports = require("assert");
10711133

10721134
"use strict";
10731135

1136+
var __importStar = (this && this.__importStar) || function (mod) {
1137+
if (mod && mod.__esModule) return mod;
1138+
var result = {};
1139+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
1140+
result["default"] = mod;
1141+
return result;
1142+
};
10741143
Object.defineProperty(exports, "__esModule", { value: true });
1075-
const os = __webpack_require__(87);
1144+
const os = __importStar(__webpack_require__(87));
1145+
const utils_1 = __webpack_require__(82);
10761146
/**
10771147
* Commands
10781148
*
10791149
* Command Format:
1080-
* ##[name key=value;key=value]message
1150+
* ::name key=value,key=value::message
10811151
*
10821152
* Examples:
1083-
* ##[warning]This is the user warning message
1084-
* ##[set-secret name=mypassword]definitelyNotAPassword!
1153+
* ::warning::This is the message
1154+
* ::set-env name=MY_VAR::some value
10851155
*/
10861156
function issueCommand(command, properties, message) {
10871157
const cmd = new Command(command, properties, message);
@@ -1106,34 +1176,39 @@ class Command {
11061176
let cmdStr = CMD_STRING + this.command;
11071177
if (this.properties && Object.keys(this.properties).length > 0) {
11081178
cmdStr += ' ';
1179+
let first = true;
11091180
for (const key in this.properties) {
11101181
if (this.properties.hasOwnProperty(key)) {
11111182
const val = this.properties[key];
11121183
if (val) {
1113-
// safely append the val - avoid blowing up when attempting to
1114-
// call .replace() if message is not a string for some reason
1115-
cmdStr += `${key}=${escape(`${val || ''}`)},`;
1184+
if (first) {
1185+
first = false;
1186+
}
1187+
else {
1188+
cmdStr += ',';
1189+
}
1190+
cmdStr += `${key}=${escapeProperty(val)}`;
11161191
}
11171192
}
11181193
}
11191194
}
1120-
cmdStr += CMD_STRING;
1121-
// safely append the message - avoid blowing up when attempting to
1122-
// call .replace() if message is not a string for some reason
1123-
const message = `${this.message || ''}`;
1124-
cmdStr += escapeData(message);
1195+
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
11251196
return cmdStr;
11261197
}
11271198
}
11281199
function escapeData(s) {
1129-
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
1200+
return utils_1.toCommandValue(s)
1201+
.replace(/%/g, '%25')
1202+
.replace(/\r/g, '%0D')
1203+
.replace(/\n/g, '%0A');
11301204
}
1131-
function escape(s) {
1132-
return s
1205+
function escapeProperty(s) {
1206+
return utils_1.toCommandValue(s)
1207+
.replace(/%/g, '%25')
11331208
.replace(/\r/g, '%0D')
11341209
.replace(/\n/g, '%0A')
1135-
.replace(/]/g, '%5D')
1136-
.replace(/;/g, '%3B');
1210+
.replace(/:/g, '%3A')
1211+
.replace(/,/g, '%2C');
11371212
}
11381213
//# sourceMappingURL=command.js.map
11391214

@@ -1153,10 +1228,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11531228
step((generator = generator.apply(thisArg, _arguments || [])).next());
11541229
});
11551230
};
1231+
var __importStar = (this && this.__importStar) || function (mod) {
1232+
if (mod && mod.__esModule) return mod;
1233+
var result = {};
1234+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
1235+
result["default"] = mod;
1236+
return result;
1237+
};
11561238
Object.defineProperty(exports, "__esModule", { value: true });
11571239
const command_1 = __webpack_require__(431);
1158-
const os = __webpack_require__(87);
1159-
const path = __webpack_require__(622);
1240+
const file_command_1 = __webpack_require__(102);
1241+
const utils_1 = __webpack_require__(82);
1242+
const os = __importStar(__webpack_require__(87));
1243+
const path = __importStar(__webpack_require__(622));
11601244
/**
11611245
* The code to exit an action
11621246
*/
@@ -1177,11 +1261,21 @@ var ExitCode;
11771261
/**
11781262
* Sets env variable for this action and future actions in the job
11791263
* @param name the name of the variable to set
1180-
* @param val the value of the variable
1264+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
11811265
*/
1266+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11821267
function exportVariable(name, val) {
1183-
process.env[name] = val;
1184-
command_1.issueCommand('set-env', { name }, val);
1268+
const convertedVal = utils_1.toCommandValue(val);
1269+
process.env[name] = convertedVal;
1270+
const filePath = process.env['GITHUB_ENV'] || '';
1271+
if (filePath) {
1272+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
1273+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
1274+
file_command_1.issueCommand('ENV', commandValue);
1275+
}
1276+
else {
1277+
command_1.issueCommand('set-env', { name }, convertedVal);
1278+
}
11851279
}
11861280
exports.exportVariable = exportVariable;
11871281
/**
@@ -1197,7 +1291,13 @@ exports.setSecret = setSecret;
11971291
* @param inputPath
11981292
*/
11991293
function addPath(inputPath) {
1200-
command_1.issueCommand('add-path', {}, inputPath);
1294+
const filePath = process.env['GITHUB_PATH'] || '';
1295+
if (filePath) {
1296+
file_command_1.issueCommand('PATH', inputPath);
1297+
}
1298+
else {
1299+
command_1.issueCommand('add-path', {}, inputPath);
1300+
}
12011301
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
12021302
}
12031303
exports.addPath = addPath;
@@ -1220,12 +1320,22 @@ exports.getInput = getInput;
12201320
* Sets the value of an output.
12211321
*
12221322
* @param name name of the output to set
1223-
* @param value value to store
1323+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
12241324
*/
1325+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
12251326
function setOutput(name, value) {
12261327
command_1.issueCommand('set-output', { name }, value);
12271328
}
12281329
exports.setOutput = setOutput;
1330+
/**
1331+
* Enables or disables the echoing of commands into stdout for the rest of the step.
1332+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
1333+
*
1334+
*/
1335+
function setCommandEcho(enabled) {
1336+
command_1.issue('echo', enabled ? 'on' : 'off');
1337+
}
1338+
exports.setCommandEcho = setCommandEcho;
12291339
//-----------------------------------------------------------------------
12301340
// Results
12311341
//-----------------------------------------------------------------------
@@ -1242,6 +1352,13 @@ exports.setFailed = setFailed;
12421352
//-----------------------------------------------------------------------
12431353
// Logging Commands
12441354
//-----------------------------------------------------------------------
1355+
/**
1356+
* Gets whether Actions Step Debug is on or not
1357+
*/
1358+
function isDebug() {
1359+
return process.env['RUNNER_DEBUG'] === '1';
1360+
}
1361+
exports.isDebug = isDebug;
12451362
/**
12461363
* Writes debug message to user log
12471364
* @param message debug message
@@ -1252,18 +1369,18 @@ function debug(message) {
12521369
exports.debug = debug;
12531370
/**
12541371
* Adds an error issue
1255-
* @param message error issue message
1372+
* @param message error issue message. Errors will be converted to string via toString()
12561373
*/
12571374
function error(message) {
1258-
command_1.issue('error', message);
1375+
command_1.issue('error', message instanceof Error ? message.toString() : message);
12591376
}
12601377
exports.error = error;
12611378
/**
12621379
* Adds an warning issue
1263-
* @param message warning issue message
1380+
* @param message warning issue message. Errors will be converted to string via toString()
12641381
*/
12651382
function warning(message) {
1266-
command_1.issue('warning', message);
1383+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
12671384
}
12681385
exports.warning = warning;
12691386
/**
@@ -1321,8 +1438,9 @@ exports.group = group;
13211438
* Saves state for current action, the state can only be retrieved by this action's post job execution.
13221439
*
13231440
* @param name name of the state to store
1324-
* @param value value to store
1441+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
13251442
*/
1443+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
13261444
function saveState(name, value) {
13271445
command_1.issueCommand('save-state', { name }, value);
13281446
}

node_modules/.bin/semver

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/semver.cmd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/semver.ps1

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/uuid

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/uuid.cmd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)