Skip to content
This repository was archived by the owner on Sep 24, 2020. It is now read-only.

Commit 4f00d78

Browse files
committed
Release v0.0.1
1 parent a878686 commit 4f00d78

File tree

1 file changed

+373
-0
lines changed

1 file changed

+373
-0
lines changed

dist/index.js

+373
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,373 @@
1+
module.exports =
2+
/******/ (function(modules, runtime) { // webpackBootstrap
3+
/******/ "use strict";
4+
/******/ // The module cache
5+
/******/ var installedModules = {};
6+
/******/
7+
/******/ // The require function
8+
/******/ function __webpack_require__(moduleId) {
9+
/******/
10+
/******/ // Check if module is in cache
11+
/******/ if(installedModules[moduleId]) {
12+
/******/ return installedModules[moduleId].exports;
13+
/******/ }
14+
/******/ // Create a new module (and put it into the cache)
15+
/******/ var module = installedModules[moduleId] = {
16+
/******/ i: moduleId,
17+
/******/ l: false,
18+
/******/ exports: {}
19+
/******/ };
20+
/******/
21+
/******/ // Execute the module function
22+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
23+
/******/
24+
/******/ // Flag the module as loaded
25+
/******/ module.l = true;
26+
/******/
27+
/******/ // Return the exports of the module
28+
/******/ return module.exports;
29+
/******/ }
30+
/******/
31+
/******/
32+
/******/ __webpack_require__.ab = __dirname + "/";
33+
/******/
34+
/******/ // the startup function
35+
/******/ function startup() {
36+
/******/ // Load entry module and return exports
37+
/******/ return __webpack_require__(104);
38+
/******/ };
39+
/******/
40+
/******/ // run startup
41+
/******/ return startup();
42+
/******/ })
43+
/************************************************************************/
44+
/******/ ({
45+
46+
/***/ 87:
47+
/***/ (function(module) {
48+
49+
module.exports = require("os");
50+
51+
/***/ }),
52+
53+
/***/ 104:
54+
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
55+
56+
const core = __webpack_require__(470)
57+
const discord_webhook = __webpack_require__(464)
58+
59+
async function run() {
60+
try {
61+
const discord_webhook_url = core.getInput('webhook_url', { required: true });
62+
63+
console.log(discord_webhook_url);
64+
discord_webhook(discord_webhook_url)
65+
66+
}
67+
catch (error) {
68+
core.setFailed(error.message);
69+
}
70+
}
71+
72+
run()
73+
74+
/***/ }),
75+
76+
/***/ 431:
77+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
78+
79+
"use strict";
80+
81+
Object.defineProperty(exports, "__esModule", { value: true });
82+
const os = __webpack_require__(87);
83+
/**
84+
* Commands
85+
*
86+
* Command Format:
87+
* ##[name key=value;key=value]message
88+
*
89+
* Examples:
90+
* ##[warning]This is the user warning message
91+
* ##[set-secret name=mypassword]definitelyNotAPassword!
92+
*/
93+
function issueCommand(command, properties, message) {
94+
const cmd = new Command(command, properties, message);
95+
process.stdout.write(cmd.toString() + os.EOL);
96+
}
97+
exports.issueCommand = issueCommand;
98+
function issue(name, message = '') {
99+
issueCommand(name, {}, message);
100+
}
101+
exports.issue = issue;
102+
const CMD_STRING = '::';
103+
class Command {
104+
constructor(command, properties, message) {
105+
if (!command) {
106+
command = 'missing.command';
107+
}
108+
this.command = command;
109+
this.properties = properties;
110+
this.message = message;
111+
}
112+
toString() {
113+
let cmdStr = CMD_STRING + this.command;
114+
if (this.properties && Object.keys(this.properties).length > 0) {
115+
cmdStr += ' ';
116+
for (const key in this.properties) {
117+
if (this.properties.hasOwnProperty(key)) {
118+
const val = this.properties[key];
119+
if (val) {
120+
// safely append the val - avoid blowing up when attempting to
121+
// call .replace() if message is not a string for some reason
122+
cmdStr += `${key}=${escape(`${val || ''}`)},`;
123+
}
124+
}
125+
}
126+
}
127+
cmdStr += CMD_STRING;
128+
// safely append the message - avoid blowing up when attempting to
129+
// call .replace() if message is not a string for some reason
130+
const message = `${this.message || ''}`;
131+
cmdStr += escapeData(message);
132+
return cmdStr;
133+
}
134+
}
135+
function escapeData(s) {
136+
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
137+
}
138+
function escape(s) {
139+
return s
140+
.replace(/\r/g, '%0D')
141+
.replace(/\n/g, '%0A')
142+
.replace(/]/g, '%5D')
143+
.replace(/;/g, '%3B');
144+
}
145+
//# sourceMappingURL=command.js.map
146+
147+
/***/ }),
148+
149+
/***/ 464:
150+
/***/ (function() {
151+
152+
const webhook = (url, data) => {
153+
var xmlhttp = new XMLHttpRequest()
154+
xmlhttp.open("POST", url, true);
155+
xmlhttp.setRequestHeader(
156+
"Content-type",
157+
"application/json; charset=UTF-8"
158+
);
159+
xmlhttp.send(JSON.stringify(data));
160+
}
161+
162+
/***/ }),
163+
164+
/***/ 470:
165+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
166+
167+
"use strict";
168+
169+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
170+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
171+
return new (P || (P = Promise))(function (resolve, reject) {
172+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
173+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
174+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
175+
step((generator = generator.apply(thisArg, _arguments || [])).next());
176+
});
177+
};
178+
Object.defineProperty(exports, "__esModule", { value: true });
179+
const command_1 = __webpack_require__(431);
180+
const os = __webpack_require__(87);
181+
const path = __webpack_require__(622);
182+
/**
183+
* The code to exit an action
184+
*/
185+
var ExitCode;
186+
(function (ExitCode) {
187+
/**
188+
* A code indicating that the action was successful
189+
*/
190+
ExitCode[ExitCode["Success"] = 0] = "Success";
191+
/**
192+
* A code indicating that the action was a failure
193+
*/
194+
ExitCode[ExitCode["Failure"] = 1] = "Failure";
195+
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
196+
//-----------------------------------------------------------------------
197+
// Variables
198+
//-----------------------------------------------------------------------
199+
/**
200+
* Sets env variable for this action and future actions in the job
201+
* @param name the name of the variable to set
202+
* @param val the value of the variable
203+
*/
204+
function exportVariable(name, val) {
205+
process.env[name] = val;
206+
command_1.issueCommand('set-env', { name }, val);
207+
}
208+
exports.exportVariable = exportVariable;
209+
/**
210+
* Registers a secret which will get masked from logs
211+
* @param secret value of the secret
212+
*/
213+
function setSecret(secret) {
214+
command_1.issueCommand('add-mask', {}, secret);
215+
}
216+
exports.setSecret = setSecret;
217+
/**
218+
* Prepends inputPath to the PATH (for this action and future actions)
219+
* @param inputPath
220+
*/
221+
function addPath(inputPath) {
222+
command_1.issueCommand('add-path', {}, inputPath);
223+
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
224+
}
225+
exports.addPath = addPath;
226+
/**
227+
* Gets the value of an input. The value is also trimmed.
228+
*
229+
* @param name name of the input to get
230+
* @param options optional. See InputOptions.
231+
* @returns string
232+
*/
233+
function getInput(name, options) {
234+
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
235+
if (options && options.required && !val) {
236+
throw new Error(`Input required and not supplied: ${name}`);
237+
}
238+
return val.trim();
239+
}
240+
exports.getInput = getInput;
241+
/**
242+
* Sets the value of an output.
243+
*
244+
* @param name name of the output to set
245+
* @param value value to store
246+
*/
247+
function setOutput(name, value) {
248+
command_1.issueCommand('set-output', { name }, value);
249+
}
250+
exports.setOutput = setOutput;
251+
//-----------------------------------------------------------------------
252+
// Results
253+
//-----------------------------------------------------------------------
254+
/**
255+
* Sets the action status to failed.
256+
* When the action exits it will be with an exit code of 1
257+
* @param message add error issue message
258+
*/
259+
function setFailed(message) {
260+
process.exitCode = ExitCode.Failure;
261+
error(message);
262+
}
263+
exports.setFailed = setFailed;
264+
//-----------------------------------------------------------------------
265+
// Logging Commands
266+
//-----------------------------------------------------------------------
267+
/**
268+
* Writes debug message to user log
269+
* @param message debug message
270+
*/
271+
function debug(message) {
272+
command_1.issueCommand('debug', {}, message);
273+
}
274+
exports.debug = debug;
275+
/**
276+
* Adds an error issue
277+
* @param message error issue message
278+
*/
279+
function error(message) {
280+
command_1.issue('error', message);
281+
}
282+
exports.error = error;
283+
/**
284+
* Adds an warning issue
285+
* @param message warning issue message
286+
*/
287+
function warning(message) {
288+
command_1.issue('warning', message);
289+
}
290+
exports.warning = warning;
291+
/**
292+
* Writes info to log with console.log.
293+
* @param message info message
294+
*/
295+
function info(message) {
296+
process.stdout.write(message + os.EOL);
297+
}
298+
exports.info = info;
299+
/**
300+
* Begin an output group.
301+
*
302+
* Output until the next `groupEnd` will be foldable in this group
303+
*
304+
* @param name The name of the output group
305+
*/
306+
function startGroup(name) {
307+
command_1.issue('group', name);
308+
}
309+
exports.startGroup = startGroup;
310+
/**
311+
* End an output group.
312+
*/
313+
function endGroup() {
314+
command_1.issue('endgroup');
315+
}
316+
exports.endGroup = endGroup;
317+
/**
318+
* Wrap an asynchronous function call in a group.
319+
*
320+
* Returns the same type as the function itself.
321+
*
322+
* @param name The name of the group
323+
* @param fn The function to wrap in the group
324+
*/
325+
function group(name, fn) {
326+
return __awaiter(this, void 0, void 0, function* () {
327+
startGroup(name);
328+
let result;
329+
try {
330+
result = yield fn();
331+
}
332+
finally {
333+
endGroup();
334+
}
335+
return result;
336+
});
337+
}
338+
exports.group = group;
339+
//-----------------------------------------------------------------------
340+
// Wrapper action state
341+
//-----------------------------------------------------------------------
342+
/**
343+
* Saves state for current action, the state can only be retrieved by this action's post job execution.
344+
*
345+
* @param name name of the state to store
346+
* @param value value to store
347+
*/
348+
function saveState(name, value) {
349+
command_1.issueCommand('save-state', { name }, value);
350+
}
351+
exports.saveState = saveState;
352+
/**
353+
* Gets the value of an state set by this action's main execution.
354+
*
355+
* @param name name of the state to get
356+
* @returns string
357+
*/
358+
function getState(name) {
359+
return process.env[`STATE_${name}`] || '';
360+
}
361+
exports.getState = getState;
362+
//# sourceMappingURL=core.js.map
363+
364+
/***/ }),
365+
366+
/***/ 622:
367+
/***/ (function(module) {
368+
369+
module.exports = require("path");
370+
371+
/***/ })
372+
373+
/******/ });

0 commit comments

Comments
 (0)