Skip to content

Commit 3dd57c8

Browse files
authored
Update dependencies (#43)
1 parent 9e5c1c7 commit 3dd57c8

File tree

3 files changed

+178
-41
lines changed

3 files changed

+178
-41
lines changed

dist/cleanup.js

+91-19
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,75 @@ module.exports =
4343
/************************************************************************/
4444
/******/ ({
4545

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

4975
module.exports = require("os");
5076

5177
/***/ }),
5278

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

@@ -89,6 +151,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
89151
};
90152
Object.defineProperty(exports, "__esModule", { value: true });
91153
const os = __importStar(__webpack_require__(87));
154+
const utils_1 = __webpack_require__(82);
92155
/**
93156
* Commands
94157
*
@@ -142,28 +205,14 @@ class Command {
142205
return cmdStr;
143206
}
144207
}
145-
/**
146-
* Sanitizes an input into a string so it can be passed into issueCommand safely
147-
* @param input input to sanitize into a string
148-
*/
149-
function toCommandValue(input) {
150-
if (input === null || input === undefined) {
151-
return '';
152-
}
153-
else if (typeof input === 'string' || input instanceof String) {
154-
return input;
155-
}
156-
return JSON.stringify(input);
157-
}
158-
exports.toCommandValue = toCommandValue;
159208
function escapeData(s) {
160-
return toCommandValue(s)
209+
return utils_1.toCommandValue(s)
161210
.replace(/%/g, '%25')
162211
.replace(/\r/g, '%0D')
163212
.replace(/\n/g, '%0A');
164213
}
165214
function escapeProperty(s) {
166-
return toCommandValue(s)
215+
return utils_1.toCommandValue(s)
167216
.replace(/%/g, '%25')
168217
.replace(/\r/g, '%0D')
169218
.replace(/\n/g, '%0A')
@@ -197,6 +246,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
197246
};
198247
Object.defineProperty(exports, "__esModule", { value: true });
199248
const command_1 = __webpack_require__(431);
249+
const file_command_1 = __webpack_require__(102);
250+
const utils_1 = __webpack_require__(82);
200251
const os = __importStar(__webpack_require__(87));
201252
const path = __importStar(__webpack_require__(622));
202253
/**
@@ -223,9 +274,17 @@ var ExitCode;
223274
*/
224275
// eslint-disable-next-line @typescript-eslint/no-explicit-any
225276
function exportVariable(name, val) {
226-
const convertedVal = command_1.toCommandValue(val);
277+
const convertedVal = utils_1.toCommandValue(val);
227278
process.env[name] = convertedVal;
228-
command_1.issueCommand('set-env', { name }, convertedVal);
279+
const filePath = process.env['GITHUB_ENV'] || '';
280+
if (filePath) {
281+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
282+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
283+
file_command_1.issueCommand('ENV', commandValue);
284+
}
285+
else {
286+
command_1.issueCommand('set-env', { name }, convertedVal);
287+
}
229288
}
230289
exports.exportVariable = exportVariable;
231290
/**
@@ -241,7 +300,13 @@ exports.setSecret = setSecret;
241300
* @param inputPath
242301
*/
243302
function addPath(inputPath) {
244-
command_1.issueCommand('add-path', {}, inputPath);
303+
const filePath = process.env['GITHUB_PATH'] || '';
304+
if (filePath) {
305+
file_command_1.issueCommand('PATH', inputPath);
306+
}
307+
else {
308+
command_1.issueCommand('add-path', {}, inputPath);
309+
}
245310
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
246311
}
247312
exports.addPath = addPath;
@@ -408,6 +473,13 @@ exports.getState = getState;
408473

409474
module.exports = require("path");
410475

476+
/***/ }),
477+
478+
/***/ 747:
479+
/***/ (function(module) {
480+
481+
module.exports = require("fs");
482+
411483
/***/ })
412484

413485
/******/ });

dist/index.js

+84-19
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,75 @@ module.exports =
4343
/************************************************************************/
4444
/******/ ({
4545

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

4975
module.exports = require("os");
5076

5177
/***/ }),
5278

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

@@ -129,6 +191,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
129191
};
130192
Object.defineProperty(exports, "__esModule", { value: true });
131193
const os = __importStar(__webpack_require__(87));
194+
const utils_1 = __webpack_require__(82);
132195
/**
133196
* Commands
134197
*
@@ -182,28 +245,14 @@ class Command {
182245
return cmdStr;
183246
}
184247
}
185-
/**
186-
* Sanitizes an input into a string so it can be passed into issueCommand safely
187-
* @param input input to sanitize into a string
188-
*/
189-
function toCommandValue(input) {
190-
if (input === null || input === undefined) {
191-
return '';
192-
}
193-
else if (typeof input === 'string' || input instanceof String) {
194-
return input;
195-
}
196-
return JSON.stringify(input);
197-
}
198-
exports.toCommandValue = toCommandValue;
199248
function escapeData(s) {
200-
return toCommandValue(s)
249+
return utils_1.toCommandValue(s)
201250
.replace(/%/g, '%25')
202251
.replace(/\r/g, '%0D')
203252
.replace(/\n/g, '%0A');
204253
}
205254
function escapeProperty(s) {
206-
return toCommandValue(s)
255+
return utils_1.toCommandValue(s)
207256
.replace(/%/g, '%25')
208257
.replace(/\r/g, '%0D')
209258
.replace(/\n/g, '%0A')
@@ -237,6 +286,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
237286
};
238287
Object.defineProperty(exports, "__esModule", { value: true });
239288
const command_1 = __webpack_require__(431);
289+
const file_command_1 = __webpack_require__(102);
290+
const utils_1 = __webpack_require__(82);
240291
const os = __importStar(__webpack_require__(87));
241292
const path = __importStar(__webpack_require__(622));
242293
/**
@@ -263,9 +314,17 @@ var ExitCode;
263314
*/
264315
// eslint-disable-next-line @typescript-eslint/no-explicit-any
265316
function exportVariable(name, val) {
266-
const convertedVal = command_1.toCommandValue(val);
317+
const convertedVal = utils_1.toCommandValue(val);
267318
process.env[name] = convertedVal;
268-
command_1.issueCommand('set-env', { name }, convertedVal);
319+
const filePath = process.env['GITHUB_ENV'] || '';
320+
if (filePath) {
321+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
322+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
323+
file_command_1.issueCommand('ENV', commandValue);
324+
}
325+
else {
326+
command_1.issueCommand('set-env', { name }, convertedVal);
327+
}
269328
}
270329
exports.exportVariable = exportVariable;
271330
/**
@@ -281,7 +340,13 @@ exports.setSecret = setSecret;
281340
* @param inputPath
282341
*/
283342
function addPath(inputPath) {
284-
command_1.issueCommand('add-path', {}, inputPath);
343+
const filePath = process.env['GITHUB_PATH'] || '';
344+
if (filePath) {
345+
file_command_1.issueCommand('PATH', inputPath);
346+
}
347+
else {
348+
command_1.issueCommand('add-path', {}, inputPath);
349+
}
285350
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
286351
}
287352
exports.addPath = addPath;

yarn.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44

55
"@actions/core@^1.2.4":
6-
version "1.2.4"
7-
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.4.tgz#96179dbf9f8d951dd74b40a0dbd5c22555d186ab"
8-
integrity sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==
6+
version "1.2.6"
7+
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09"
8+
integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==
99

1010
"@zeit/ncc@^0.20.5":
1111
version "0.20.5"

0 commit comments

Comments
 (0)