Skip to content

Commit 309e4f9

Browse files
author
GitHub Actions
committed
chore: Update dist
1 parent f236cf7 commit 309e4f9

File tree

2 files changed

+175
-38
lines changed

2 files changed

+175
-38
lines changed

dist/cleanup/index.js

Lines changed: 91 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,75 @@ module.exports =
4949
/************************************************************************/
5050
/******/ ({
5151

52+
/***/ 82:
53+
/***/ (function(__unusedmodule, exports) {
54+
55+
"use strict";
56+
57+
// We use any as a valid input type
58+
/* eslint-disable @typescript-eslint/no-explicit-any */
59+
Object.defineProperty(exports, "__esModule", { value: true });
60+
/**
61+
* Sanitizes an input into a string so it can be passed into issueCommand safely
62+
* @param input input to sanitize into a string
63+
*/
64+
function toCommandValue(input) {
65+
if (input === null || input === undefined) {
66+
return '';
67+
}
68+
else if (typeof input === 'string' || input instanceof String) {
69+
return input;
70+
}
71+
return JSON.stringify(input);
72+
}
73+
exports.toCommandValue = toCommandValue;
74+
//# sourceMappingURL=utils.js.map
75+
76+
/***/ }),
77+
5278
/***/ 87:
5379
/***/ (function(module) {
5480

5581
module.exports = require("os");
5682

5783
/***/ }),
5884

85+
/***/ 102:
86+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
87+
88+
"use strict";
89+
90+
// For internal use, subject to change.
91+
var __importStar = (this && this.__importStar) || function (mod) {
92+
if (mod && mod.__esModule) return mod;
93+
var result = {};
94+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
95+
result["default"] = mod;
96+
return result;
97+
};
98+
Object.defineProperty(exports, "__esModule", { value: true });
99+
// We use any as a valid input type
100+
/* eslint-disable @typescript-eslint/no-explicit-any */
101+
const fs = __importStar(__webpack_require__(747));
102+
const os = __importStar(__webpack_require__(87));
103+
const utils_1 = __webpack_require__(82);
104+
function issueCommand(command, message) {
105+
const filePath = process.env[`GITHUB_${command}`];
106+
if (!filePath) {
107+
throw new Error(`Unable to find environment variable for file command ${command}`);
108+
}
109+
if (!fs.existsSync(filePath)) {
110+
throw new Error(`Missing file at path: ${filePath}`);
111+
}
112+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
113+
encoding: 'utf8'
114+
});
115+
}
116+
exports.issueCommand = issueCommand;
117+
//# sourceMappingURL=file-command.js.map
118+
119+
/***/ }),
120+
59121
/***/ 175:
60122
/***/ (function(module, __unusedexports, __webpack_require__) {
61123

@@ -113,6 +175,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
113175
};
114176
Object.defineProperty(exports, "__esModule", { value: true });
115177
const os = __importStar(__webpack_require__(87));
178+
const utils_1 = __webpack_require__(82);
116179
/**
117180
* Commands
118181
*
@@ -166,28 +229,14 @@ class Command {
166229
return cmdStr;
167230
}
168231
}
169-
/**
170-
* Sanitizes an input into a string so it can be passed into issueCommand safely
171-
* @param input input to sanitize into a string
172-
*/
173-
function toCommandValue(input) {
174-
if (input === null || input === undefined) {
175-
return '';
176-
}
177-
else if (typeof input === 'string' || input instanceof String) {
178-
return input;
179-
}
180-
return JSON.stringify(input);
181-
}
182-
exports.toCommandValue = toCommandValue;
183232
function escapeData(s) {
184-
return toCommandValue(s)
233+
return utils_1.toCommandValue(s)
185234
.replace(/%/g, '%25')
186235
.replace(/\r/g, '%0D')
187236
.replace(/\n/g, '%0A');
188237
}
189238
function escapeProperty(s) {
190-
return toCommandValue(s)
239+
return utils_1.toCommandValue(s)
191240
.replace(/%/g, '%25')
192241
.replace(/\r/g, '%0D')
193242
.replace(/\n/g, '%0A')
@@ -221,6 +270,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
221270
};
222271
Object.defineProperty(exports, "__esModule", { value: true });
223272
const command_1 = __webpack_require__(431);
273+
const file_command_1 = __webpack_require__(102);
274+
const utils_1 = __webpack_require__(82);
224275
const os = __importStar(__webpack_require__(87));
225276
const path = __importStar(__webpack_require__(622));
226277
/**
@@ -247,9 +298,17 @@ var ExitCode;
247298
*/
248299
// eslint-disable-next-line @typescript-eslint/no-explicit-any
249300
function exportVariable(name, val) {
250-
const convertedVal = command_1.toCommandValue(val);
301+
const convertedVal = utils_1.toCommandValue(val);
251302
process.env[name] = convertedVal;
252-
command_1.issueCommand('set-env', { name }, convertedVal);
303+
const filePath = process.env['GITHUB_ENV'] || '';
304+
if (filePath) {
305+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
306+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
307+
file_command_1.issueCommand('ENV', commandValue);
308+
}
309+
else {
310+
command_1.issueCommand('set-env', { name }, convertedVal);
311+
}
253312
}
254313
exports.exportVariable = exportVariable;
255314
/**
@@ -265,7 +324,13 @@ exports.setSecret = setSecret;
265324
* @param inputPath
266325
*/
267326
function addPath(inputPath) {
268-
command_1.issueCommand('add-path', {}, inputPath);
327+
const filePath = process.env['GITHUB_PATH'] || '';
328+
if (filePath) {
329+
file_command_1.issueCommand('PATH', inputPath);
330+
}
331+
else {
332+
command_1.issueCommand('add-path', {}, inputPath);
333+
}
269334
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
270335
}
271336
exports.addPath = addPath;
@@ -432,6 +497,13 @@ exports.getState = getState;
432497

433498
module.exports = require("path");
434499

500+
/***/ }),
501+
502+
/***/ 747:
503+
/***/ (function(module) {
504+
505+
module.exports = require("fs");
506+
435507
/***/ })
436508

437509
/******/ });

dist/index.js

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

0 commit comments

Comments
 (0)