Skip to content

Commit 3bc8e69

Browse files
committedJul 14, 2022
test
1 parent 028e7ad commit 3bc8e69

File tree

4 files changed

+490
-30
lines changed

4 files changed

+490
-30
lines changed
 

‎dist/index.js

+474-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,464 @@
11
/******/ (() => { // webpackBootstrap
22
/******/ var __webpack_modules__ = ({
33

4-
/***/ 889:
5-
/***/ ((module) => {
4+
/***/ 209:
5+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
66

7-
module.exports = eval("require")("@actions/core");
7+
"use strict";
88

9+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12+
}) : (function(o, m, k, k2) {
13+
if (k2 === undefined) k2 = k;
14+
o[k2] = m[k];
15+
}));
16+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17+
Object.defineProperty(o, "default", { enumerable: true, value: v });
18+
}) : function(o, v) {
19+
o["default"] = v;
20+
});
21+
var __importStar = (this && this.__importStar) || function (mod) {
22+
if (mod && mod.__esModule) return mod;
23+
var result = {};
24+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25+
__setModuleDefault(result, mod);
26+
return result;
27+
};
28+
Object.defineProperty(exports, "__esModule", ({ value: true }));
29+
exports.issue = exports.issueCommand = void 0;
30+
const os = __importStar(__nccwpck_require__(37));
31+
const utils_1 = __nccwpck_require__(262);
32+
/**
33+
* Commands
34+
*
35+
* Command Format:
36+
* ::name key=value,key=value::message
37+
*
38+
* Examples:
39+
* ::warning::This is the message
40+
* ::set-env name=MY_VAR::some value
41+
*/
42+
function issueCommand(command, properties, message) {
43+
const cmd = new Command(command, properties, message);
44+
process.stdout.write(cmd.toString() + os.EOL);
45+
}
46+
exports.issueCommand = issueCommand;
47+
function issue(name, message = '') {
48+
issueCommand(name, {}, message);
49+
}
50+
exports.issue = issue;
51+
const CMD_STRING = '::';
52+
class Command {
53+
constructor(command, properties, message) {
54+
if (!command) {
55+
command = 'missing.command';
56+
}
57+
this.command = command;
58+
this.properties = properties;
59+
this.message = message;
60+
}
61+
toString() {
62+
let cmdStr = CMD_STRING + this.command;
63+
if (this.properties && Object.keys(this.properties).length > 0) {
64+
cmdStr += ' ';
65+
let first = true;
66+
for (const key in this.properties) {
67+
if (this.properties.hasOwnProperty(key)) {
68+
const val = this.properties[key];
69+
if (val) {
70+
if (first) {
71+
first = false;
72+
}
73+
else {
74+
cmdStr += ',';
75+
}
76+
cmdStr += `${key}=${escapeProperty(val)}`;
77+
}
78+
}
79+
}
80+
}
81+
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
82+
return cmdStr;
83+
}
84+
}
85+
function escapeData(s) {
86+
return utils_1.toCommandValue(s)
87+
.replace(/%/g, '%25')
88+
.replace(/\r/g, '%0D')
89+
.replace(/\n/g, '%0A');
90+
}
91+
function escapeProperty(s) {
92+
return utils_1.toCommandValue(s)
93+
.replace(/%/g, '%25')
94+
.replace(/\r/g, '%0D')
95+
.replace(/\n/g, '%0A')
96+
.replace(/:/g, '%3A')
97+
.replace(/,/g, '%2C');
98+
}
99+
//# sourceMappingURL=command.js.map
100+
101+
/***/ }),
102+
103+
/***/ 695:
104+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
105+
106+
"use strict";
107+
108+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
109+
if (k2 === undefined) k2 = k;
110+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
111+
}) : (function(o, m, k, k2) {
112+
if (k2 === undefined) k2 = k;
113+
o[k2] = m[k];
114+
}));
115+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
116+
Object.defineProperty(o, "default", { enumerable: true, value: v });
117+
}) : function(o, v) {
118+
o["default"] = v;
119+
});
120+
var __importStar = (this && this.__importStar) || function (mod) {
121+
if (mod && mod.__esModule) return mod;
122+
var result = {};
123+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
124+
__setModuleDefault(result, mod);
125+
return result;
126+
};
127+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
128+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
129+
return new (P || (P = Promise))(function (resolve, reject) {
130+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
131+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
132+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
133+
step((generator = generator.apply(thisArg, _arguments || [])).next());
134+
});
135+
};
136+
Object.defineProperty(exports, "__esModule", ({ value: true }));
137+
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
138+
const command_1 = __nccwpck_require__(209);
139+
const file_command_1 = __nccwpck_require__(583);
140+
const utils_1 = __nccwpck_require__(262);
141+
const os = __importStar(__nccwpck_require__(37));
142+
const path = __importStar(__nccwpck_require__(17));
143+
/**
144+
* The code to exit an action
145+
*/
146+
var ExitCode;
147+
(function (ExitCode) {
148+
/**
149+
* A code indicating that the action was successful
150+
*/
151+
ExitCode[ExitCode["Success"] = 0] = "Success";
152+
/**
153+
* A code indicating that the action was a failure
154+
*/
155+
ExitCode[ExitCode["Failure"] = 1] = "Failure";
156+
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
157+
//-----------------------------------------------------------------------
158+
// Variables
159+
//-----------------------------------------------------------------------
160+
/**
161+
* Sets env variable for this action and future actions in the job
162+
* @param name the name of the variable to set
163+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
164+
*/
165+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
166+
function exportVariable(name, val) {
167+
const convertedVal = utils_1.toCommandValue(val);
168+
process.env[name] = convertedVal;
169+
const filePath = process.env['GITHUB_ENV'] || '';
170+
if (filePath) {
171+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
172+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
173+
file_command_1.issueCommand('ENV', commandValue);
174+
}
175+
else {
176+
command_1.issueCommand('set-env', { name }, convertedVal);
177+
}
178+
}
179+
exports.exportVariable = exportVariable;
180+
/**
181+
* Registers a secret which will get masked from logs
182+
* @param secret value of the secret
183+
*/
184+
function setSecret(secret) {
185+
command_1.issueCommand('add-mask', {}, secret);
186+
}
187+
exports.setSecret = setSecret;
188+
/**
189+
* Prepends inputPath to the PATH (for this action and future actions)
190+
* @param inputPath
191+
*/
192+
function addPath(inputPath) {
193+
const filePath = process.env['GITHUB_PATH'] || '';
194+
if (filePath) {
195+
file_command_1.issueCommand('PATH', inputPath);
196+
}
197+
else {
198+
command_1.issueCommand('add-path', {}, inputPath);
199+
}
200+
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
201+
}
202+
exports.addPath = addPath;
203+
/**
204+
* Gets the value of an input.
205+
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
206+
* Returns an empty string if the value is not defined.
207+
*
208+
* @param name name of the input to get
209+
* @param options optional. See InputOptions.
210+
* @returns string
211+
*/
212+
function getInput(name, options) {
213+
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
214+
if (options && options.required && !val) {
215+
throw new Error(`Input required and not supplied: ${name}`);
216+
}
217+
if (options && options.trimWhitespace === false) {
218+
return val;
219+
}
220+
return val.trim();
221+
}
222+
exports.getInput = getInput;
223+
/**
224+
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
225+
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
226+
* The return value is also in boolean type.
227+
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
228+
*
229+
* @param name name of the input to get
230+
* @param options optional. See InputOptions.
231+
* @returns boolean
232+
*/
233+
function getBooleanInput(name, options) {
234+
const trueValue = ['true', 'True', 'TRUE'];
235+
const falseValue = ['false', 'False', 'FALSE'];
236+
const val = getInput(name, options);
237+
if (trueValue.includes(val))
238+
return true;
239+
if (falseValue.includes(val))
240+
return false;
241+
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
242+
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
243+
}
244+
exports.getBooleanInput = getBooleanInput;
245+
/**
246+
* Sets the value of an output.
247+
*
248+
* @param name name of the output to set
249+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
250+
*/
251+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
252+
function setOutput(name, value) {
253+
process.stdout.write(os.EOL);
254+
command_1.issueCommand('set-output', { name }, value);
255+
}
256+
exports.setOutput = setOutput;
257+
/**
258+
* Enables or disables the echoing of commands into stdout for the rest of the step.
259+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
260+
*
261+
*/
262+
function setCommandEcho(enabled) {
263+
command_1.issue('echo', enabled ? 'on' : 'off');
264+
}
265+
exports.setCommandEcho = setCommandEcho;
266+
//-----------------------------------------------------------------------
267+
// Results
268+
//-----------------------------------------------------------------------
269+
/**
270+
* Sets the action status to failed.
271+
* When the action exits it will be with an exit code of 1
272+
* @param message add error issue message
273+
*/
274+
function setFailed(message) {
275+
process.exitCode = ExitCode.Failure;
276+
error(message);
277+
}
278+
exports.setFailed = setFailed;
279+
//-----------------------------------------------------------------------
280+
// Logging Commands
281+
//-----------------------------------------------------------------------
282+
/**
283+
* Gets whether Actions Step Debug is on or not
284+
*/
285+
function isDebug() {
286+
return process.env['RUNNER_DEBUG'] === '1';
287+
}
288+
exports.isDebug = isDebug;
289+
/**
290+
* Writes debug message to user log
291+
* @param message debug message
292+
*/
293+
function debug(message) {
294+
command_1.issueCommand('debug', {}, message);
295+
}
296+
exports.debug = debug;
297+
/**
298+
* Adds an error issue
299+
* @param message error issue message. Errors will be converted to string via toString()
300+
*/
301+
function error(message) {
302+
command_1.issue('error', message instanceof Error ? message.toString() : message);
303+
}
304+
exports.error = error;
305+
/**
306+
* Adds an warning issue
307+
* @param message warning issue message. Errors will be converted to string via toString()
308+
*/
309+
function warning(message) {
310+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
311+
}
312+
exports.warning = warning;
313+
/**
314+
* Writes info to log with console.log.
315+
* @param message info message
316+
*/
317+
function info(message) {
318+
process.stdout.write(message + os.EOL);
319+
}
320+
exports.info = info;
321+
/**
322+
* Begin an output group.
323+
*
324+
* Output until the next `groupEnd` will be foldable in this group
325+
*
326+
* @param name The name of the output group
327+
*/
328+
function startGroup(name) {
329+
command_1.issue('group', name);
330+
}
331+
exports.startGroup = startGroup;
332+
/**
333+
* End an output group.
334+
*/
335+
function endGroup() {
336+
command_1.issue('endgroup');
337+
}
338+
exports.endGroup = endGroup;
339+
/**
340+
* Wrap an asynchronous function call in a group.
341+
*
342+
* Returns the same type as the function itself.
343+
*
344+
* @param name The name of the group
345+
* @param fn The function to wrap in the group
346+
*/
347+
function group(name, fn) {
348+
return __awaiter(this, void 0, void 0, function* () {
349+
startGroup(name);
350+
let result;
351+
try {
352+
result = yield fn();
353+
}
354+
finally {
355+
endGroup();
356+
}
357+
return result;
358+
});
359+
}
360+
exports.group = group;
361+
//-----------------------------------------------------------------------
362+
// Wrapper action state
363+
//-----------------------------------------------------------------------
364+
/**
365+
* Saves state for current action, the state can only be retrieved by this action's post job execution.
366+
*
367+
* @param name name of the state to store
368+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
369+
*/
370+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
371+
function saveState(name, value) {
372+
command_1.issueCommand('save-state', { name }, value);
373+
}
374+
exports.saveState = saveState;
375+
/**
376+
* Gets the value of an state set by this action's main execution.
377+
*
378+
* @param name name of the state to get
379+
* @returns string
380+
*/
381+
function getState(name) {
382+
return process.env[`STATE_${name}`] || '';
383+
}
384+
exports.getState = getState;
385+
//# sourceMappingURL=core.js.map
386+
387+
/***/ }),
388+
389+
/***/ 583:
390+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
391+
392+
"use strict";
393+
394+
// For internal use, subject to change.
395+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
396+
if (k2 === undefined) k2 = k;
397+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
398+
}) : (function(o, m, k, k2) {
399+
if (k2 === undefined) k2 = k;
400+
o[k2] = m[k];
401+
}));
402+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
403+
Object.defineProperty(o, "default", { enumerable: true, value: v });
404+
}) : function(o, v) {
405+
o["default"] = v;
406+
});
407+
var __importStar = (this && this.__importStar) || function (mod) {
408+
if (mod && mod.__esModule) return mod;
409+
var result = {};
410+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
411+
__setModuleDefault(result, mod);
412+
return result;
413+
};
414+
Object.defineProperty(exports, "__esModule", ({ value: true }));
415+
exports.issueCommand = void 0;
416+
// We use any as a valid input type
417+
/* eslint-disable @typescript-eslint/no-explicit-any */
418+
const fs = __importStar(__nccwpck_require__(147));
419+
const os = __importStar(__nccwpck_require__(37));
420+
const utils_1 = __nccwpck_require__(262);
421+
function issueCommand(command, message) {
422+
const filePath = process.env[`GITHUB_${command}`];
423+
if (!filePath) {
424+
throw new Error(`Unable to find environment variable for file command ${command}`);
425+
}
426+
if (!fs.existsSync(filePath)) {
427+
throw new Error(`Missing file at path: ${filePath}`);
428+
}
429+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
430+
encoding: 'utf8'
431+
});
432+
}
433+
exports.issueCommand = issueCommand;
434+
//# sourceMappingURL=file-command.js.map
435+
436+
/***/ }),
437+
438+
/***/ 262:
439+
/***/ ((__unused_webpack_module, exports) => {
440+
441+
"use strict";
442+
443+
// We use any as a valid input type
444+
/* eslint-disable @typescript-eslint/no-explicit-any */
445+
Object.defineProperty(exports, "__esModule", ({ value: true }));
446+
exports.toCommandValue = void 0;
447+
/**
448+
* Sanitizes an input into a string so it can be passed into issueCommand safely
449+
* @param input input to sanitize into a string
450+
*/
451+
function toCommandValue(input) {
452+
if (input === null || input === undefined) {
453+
return '';
454+
}
455+
else if (typeof input === 'string' || input instanceof String) {
456+
return input;
457+
}
458+
return JSON.stringify(input);
459+
}
460+
exports.toCommandValue = toCommandValue;
461+
//# sourceMappingURL=utils.js.map
9462

10463
/***/ }),
11464

@@ -15,6 +468,22 @@ module.exports = eval("require")("@actions/core");
15468
"use strict";
16469
module.exports = require("fs");
17470

471+
/***/ }),
472+
473+
/***/ 37:
474+
/***/ ((module) => {
475+
476+
"use strict";
477+
module.exports = require("os");
478+
479+
/***/ }),
480+
481+
/***/ 17:
482+
/***/ ((module) => {
483+
484+
"use strict";
485+
module.exports = require("path");
486+
18487
/***/ })
19488

20489
/******/ });
@@ -39,7 +508,7 @@ module.exports = require("fs");
39508
/******/ // Execute the module function
40509
/******/ var threw = true;
41510
/******/ try {
42-
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
511+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
43512
/******/ threw = false;
44513
/******/ } finally {
45514
/******/ if(threw) delete __webpack_module_cache__[moduleId];
@@ -58,7 +527,7 @@ module.exports = require("fs");
58527
var __webpack_exports__ = {};
59528
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
60529
(() => {
61-
const { exportVariable, setFailed } = __nccwpck_require__(889);
530+
const { exportVariable, setFailed } = __nccwpck_require__(695);
62531
const { readFileSync } = __nccwpck_require__(147);
63532

64533
try {

‎dist/licenses.txt

-21
This file was deleted.

‎dist/package.json

-3
This file was deleted.

‎package-lock.json

+16-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.