@@ -2932,6 +2932,32 @@ module.exports = function(tagname, parent, val) {
2932
2932
};
2933
2933
2934
2934
2935
+ /***/ }),
2936
+
2937
+ /***/ 82:
2938
+ /***/ (function(__unusedmodule, exports) {
2939
+
2940
+ "use strict";
2941
+
2942
+ // We use any as a valid input type
2943
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2944
+ Object.defineProperty(exports, "__esModule", { value: true });
2945
+ /**
2946
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
2947
+ * @param input input to sanitize into a string
2948
+ */
2949
+ function toCommandValue(input) {
2950
+ if (input === null || input === undefined) {
2951
+ return '';
2952
+ }
2953
+ else if (typeof input === 'string' || input instanceof String) {
2954
+ return input;
2955
+ }
2956
+ return JSON.stringify(input);
2957
+ }
2958
+ exports.toCommandValue = toCommandValue;
2959
+ //# sourceMappingURL=utils.js.map
2960
+
2935
2961
/***/ }),
2936
2962
2937
2963
/***/ 87:
@@ -2941,6 +2967,42 @@ module.exports = require("os");
2941
2967
2942
2968
/***/ }),
2943
2969
2970
+ /***/ 102:
2971
+ /***/ (function(__unusedmodule, exports, __webpack_require__) {
2972
+
2973
+ "use strict";
2974
+
2975
+ // For internal use, subject to change.
2976
+ var __importStar = (this && this.__importStar) || function (mod) {
2977
+ if (mod && mod.__esModule) return mod;
2978
+ var result = {};
2979
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
2980
+ result["default"] = mod;
2981
+ return result;
2982
+ };
2983
+ Object.defineProperty(exports, "__esModule", { value: true });
2984
+ // We use any as a valid input type
2985
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2986
+ const fs = __importStar(__webpack_require__(747));
2987
+ const os = __importStar(__webpack_require__(87));
2988
+ const utils_1 = __webpack_require__(82);
2989
+ function issueCommand(command, message) {
2990
+ const filePath = process.env[`GITHUB_${command}`];
2991
+ if (!filePath) {
2992
+ throw new Error(`Unable to find environment variable for file command ${command}`);
2993
+ }
2994
+ if (!fs.existsSync(filePath)) {
2995
+ throw new Error(`Missing file at path: ${filePath}`);
2996
+ }
2997
+ fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
2998
+ encoding: 'utf8'
2999
+ });
3000
+ }
3001
+ exports.issueCommand = issueCommand;
3002
+ //# sourceMappingURL=file-command.js.map
3003
+
3004
+ /***/ }),
3005
+
2944
3006
/***/ 118:
2945
3007
/***/ (function(module, __unusedexports, __webpack_require__) {
2946
3008
@@ -8936,6 +8998,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
8936
8998
};
8937
8999
Object.defineProperty(exports, "__esModule", { value: true });
8938
9000
const os = __importStar(__webpack_require__(87));
9001
+ const utils_1 = __webpack_require__(82);
8939
9002
/**
8940
9003
* Commands
8941
9004
*
@@ -8989,28 +9052,14 @@ class Command {
8989
9052
return cmdStr;
8990
9053
}
8991
9054
}
8992
- /**
8993
- * Sanitizes an input into a string so it can be passed into issueCommand safely
8994
- * @param input input to sanitize into a string
8995
- */
8996
- function toCommandValue(input) {
8997
- if (input === null || input === undefined) {
8998
- return '';
8999
- }
9000
- else if (typeof input === 'string' || input instanceof String) {
9001
- return input;
9002
- }
9003
- return JSON.stringify(input);
9004
- }
9005
- exports.toCommandValue = toCommandValue;
9006
9055
function escapeData(s) {
9007
- return toCommandValue(s)
9056
+ return utils_1. toCommandValue(s)
9008
9057
.replace(/%/g, '%25')
9009
9058
.replace(/\r/g, '%0D')
9010
9059
.replace(/\n/g, '%0A');
9011
9060
}
9012
9061
function escapeProperty(s) {
9013
- return toCommandValue(s)
9062
+ return utils_1. toCommandValue(s)
9014
9063
.replace(/%/g, '%25')
9015
9064
.replace(/\r/g, '%0D')
9016
9065
.replace(/\n/g, '%0A')
@@ -11241,6 +11290,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
11241
11290
};
11242
11291
Object.defineProperty(exports, "__esModule", { value: true });
11243
11292
const command_1 = __webpack_require__(431);
11293
+ const file_command_1 = __webpack_require__(102);
11294
+ const utils_1 = __webpack_require__(82);
11244
11295
const os = __importStar(__webpack_require__(87));
11245
11296
const path = __importStar(__webpack_require__(622));
11246
11297
/**
@@ -11267,9 +11318,17 @@ var ExitCode;
11267
11318
*/
11268
11319
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11269
11320
function exportVariable(name, val) {
11270
- const convertedVal = command_1 .toCommandValue(val);
11321
+ const convertedVal = utils_1 .toCommandValue(val);
11271
11322
process.env[name] = convertedVal;
11272
- command_1.issueCommand('set-env', { name }, convertedVal);
11323
+ const filePath = process.env['GITHUB_ENV'] || '';
11324
+ if (filePath) {
11325
+ const delimiter = '_GitHubActionsFileCommandDelimeter_';
11326
+ const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
11327
+ file_command_1.issueCommand('ENV', commandValue);
11328
+ }
11329
+ else {
11330
+ command_1.issueCommand('set-env', { name }, convertedVal);
11331
+ }
11273
11332
}
11274
11333
exports.exportVariable = exportVariable;
11275
11334
/**
@@ -11285,7 +11344,13 @@ exports.setSecret = setSecret;
11285
11344
* @param inputPath
11286
11345
*/
11287
11346
function addPath(inputPath) {
11288
- command_1.issueCommand('add-path', {}, inputPath);
11347
+ const filePath = process.env['GITHUB_PATH'] || '';
11348
+ if (filePath) {
11349
+ file_command_1.issueCommand('PATH', inputPath);
11350
+ }
11351
+ else {
11352
+ command_1.issueCommand('add-path', {}, inputPath);
11353
+ }
11289
11354
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
11290
11355
}
11291
11356
exports.addPath = addPath;
0 commit comments