Skip to content

Commit 13ec527

Browse files
authored
build: update distribution
1 parent bcf9790 commit 13ec527

1 file changed

Lines changed: 84 additions & 19 deletions

File tree

dist/index.js

Lines changed: 84 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
12371237
};
12381238
Object.defineProperty(exports, "__esModule", ({ value: true }));
12391239
const os = __importStar(__webpack_require__(87));
1240+
const utils_1 = __webpack_require__(278);
12401241
/**
12411242
* Commands
12421243
*
@@ -1290,28 +1291,14 @@ class Command {
12901291
return cmdStr;
12911292
}
12921293
}
1293-
/**
1294-
* Sanitizes an input into a string so it can be passed into issueCommand safely
1295-
* @param input input to sanitize into a string
1296-
*/
1297-
function toCommandValue(input) {
1298-
if (input === null || input === undefined) {
1299-
return '';
1300-
}
1301-
else if (typeof input === 'string' || input instanceof String) {
1302-
return input;
1303-
}
1304-
return JSON.stringify(input);
1305-
}
1306-
exports.toCommandValue = toCommandValue;
13071294
function escapeData(s) {
1308-
return toCommandValue(s)
1295+
return utils_1.toCommandValue(s)
13091296
.replace(/%/g, '%25')
13101297
.replace(/\r/g, '%0D')
13111298
.replace(/\n/g, '%0A');
13121299
}
13131300
function escapeProperty(s) {
1314-
return toCommandValue(s)
1301+
return utils_1.toCommandValue(s)
13151302
.replace(/%/g, '%25')
13161303
.replace(/\r/g, '%0D')
13171304
.replace(/\n/g, '%0A')
@@ -1345,6 +1332,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
13451332
};
13461333
Object.defineProperty(exports, "__esModule", ({ value: true }));
13471334
const command_1 = __webpack_require__(351);
1335+
const file_command_1 = __webpack_require__(717);
1336+
const utils_1 = __webpack_require__(278);
13481337
const os = __importStar(__webpack_require__(87));
13491338
const path = __importStar(__webpack_require__(622));
13501339
/**
@@ -1371,9 +1360,17 @@ var ExitCode;
13711360
*/
13721361
// eslint-disable-next-line @typescript-eslint/no-explicit-any
13731362
function exportVariable(name, val) {
1374-
const convertedVal = command_1.toCommandValue(val);
1363+
const convertedVal = utils_1.toCommandValue(val);
13751364
process.env[name] = convertedVal;
1376-
command_1.issueCommand('set-env', { name }, convertedVal);
1365+
const filePath = process.env['GITHUB_ENV'] || '';
1366+
if (filePath) {
1367+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
1368+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
1369+
file_command_1.issueCommand('ENV', commandValue);
1370+
}
1371+
else {
1372+
command_1.issueCommand('set-env', { name }, convertedVal);
1373+
}
13771374
}
13781375
exports.exportVariable = exportVariable;
13791376
/**
@@ -1389,7 +1386,13 @@ exports.setSecret = setSecret;
13891386
* @param inputPath
13901387
*/
13911388
function addPath(inputPath) {
1392-
command_1.issueCommand('add-path', {}, inputPath);
1389+
const filePath = process.env['GITHUB_PATH'] || '';
1390+
if (filePath) {
1391+
file_command_1.issueCommand('PATH', inputPath);
1392+
}
1393+
else {
1394+
command_1.issueCommand('add-path', {}, inputPath);
1395+
}
13931396
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
13941397
}
13951398
exports.addPath = addPath;
@@ -1551,6 +1554,68 @@ exports.getState = getState;
15511554

15521555
/***/ }),
15531556

1557+
/***/ 717:
1558+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1559+
1560+
"use strict";
1561+
1562+
// For internal use, subject to change.
1563+
var __importStar = (this && this.__importStar) || function (mod) {
1564+
if (mod && mod.__esModule) return mod;
1565+
var result = {};
1566+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
1567+
result["default"] = mod;
1568+
return result;
1569+
};
1570+
Object.defineProperty(exports, "__esModule", ({ value: true }));
1571+
// We use any as a valid input type
1572+
/* eslint-disable @typescript-eslint/no-explicit-any */
1573+
const fs = __importStar(__webpack_require__(747));
1574+
const os = __importStar(__webpack_require__(87));
1575+
const utils_1 = __webpack_require__(278);
1576+
function issueCommand(command, message) {
1577+
const filePath = process.env[`GITHUB_${command}`];
1578+
if (!filePath) {
1579+
throw new Error(`Unable to find environment variable for file command ${command}`);
1580+
}
1581+
if (!fs.existsSync(filePath)) {
1582+
throw new Error(`Missing file at path: ${filePath}`);
1583+
}
1584+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
1585+
encoding: 'utf8'
1586+
});
1587+
}
1588+
exports.issueCommand = issueCommand;
1589+
//# sourceMappingURL=file-command.js.map
1590+
1591+
/***/ }),
1592+
1593+
/***/ 278:
1594+
/***/ ((__unused_webpack_module, exports) => {
1595+
1596+
"use strict";
1597+
1598+
// We use any as a valid input type
1599+
/* eslint-disable @typescript-eslint/no-explicit-any */
1600+
Object.defineProperty(exports, "__esModule", ({ value: true }));
1601+
/**
1602+
* Sanitizes an input into a string so it can be passed into issueCommand safely
1603+
* @param input input to sanitize into a string
1604+
*/
1605+
function toCommandValue(input) {
1606+
if (input === null || input === undefined) {
1607+
return '';
1608+
}
1609+
else if (typeof input === 'string' || input instanceof String) {
1610+
return input;
1611+
}
1612+
return JSON.stringify(input);
1613+
}
1614+
exports.toCommandValue = toCommandValue;
1615+
//# sourceMappingURL=utils.js.map
1616+
1617+
/***/ }),
1618+
15541619
/***/ 514:
15551620
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
15561621

0 commit comments

Comments
 (0)