Add support for environment variables (fixed #17) (#19)

* v2.0.0 (#12)

- Convert project to Javascript/Typescript
- Allow custom headers to be passed in (optional)
- Allow body to be optional

* Update action.yml

* Update action.yml

* Add support for environment variables (fixed #17)

* Add support for header as environment variables

* Run build and package

Co-authored-by: Joel Male <joel@joelmale.com>
This commit is contained in:
Anand Chowdhary 2020-08-27 13:44:30 +05:30 committed by GitHub
parent e22e83d67d
commit 517289c047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 16 additions and 16 deletions

10
dist/index.js vendored
View File

@ -2129,13 +2129,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
var core = __webpack_require__(186);
var http_1 = __webpack_require__(319);
function run() {
var _a, _b;
var _a, _b, _c, _d, _e;
return __awaiter(this, void 0, void 0, function () {
var url, headers, body;
return __generator(this, function (_c) {
url = core.getInput('url');
headers = (_a = core.getInput('headers')) !== null && _a !== void 0 ? _a : null;
body = (_b = core.getInput('body')) !== null && _b !== void 0 ? _b : null;
return __generator(this, function (_f) {
url = (_a = core.getInput('url')) !== null && _a !== void 0 ? _a : process.env.WEBHOOK_URL;
headers = (_c = (_b = core.getInput('headers')) !== null && _b !== void 0 ? _b : process.env.HEADERS) !== null && _c !== void 0 ? _c : null;
body = (_e = (_d = core.getInput('body')) !== null && _d !== void 0 ? _d : process.env.data) !== null && _e !== void 0 ? _e : null;
core.info("Sending webhook request to " + url);
core.debug((new Date()).toTimeString());
http_1.http.make(url, headers, body)

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

10
dist/main.js vendored
View File

@ -39,13 +39,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
var core = require("@actions/core");
var http_1 = require("./http");
function run() {
var _a, _b;
var _a, _b, _c, _d, _e;
return __awaiter(this, void 0, void 0, function () {
var url, headers, body;
return __generator(this, function (_c) {
url = core.getInput('url');
headers = (_a = core.getInput('headers')) !== null && _a !== void 0 ? _a : null;
body = (_b = core.getInput('body')) !== null && _b !== void 0 ? _b : null;
return __generator(this, function (_f) {
url = (_a = core.getInput('url')) !== null && _a !== void 0 ? _a : process.env.WEBHOOK_URL;
headers = (_c = (_b = core.getInput('headers')) !== null && _b !== void 0 ? _b : process.env.HEADERS) !== null && _c !== void 0 ? _c : null;
body = (_e = (_d = core.getInput('body')) !== null && _d !== void 0 ? _d : process.env.data) !== null && _e !== void 0 ? _e : null;
core.info("Sending webhook request to " + url);
core.debug((new Date()).toTimeString());
http_1.http.make(url, headers, body)

2
dist/main.js.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAsC;AACtC,+BAA8B;AAE9B,SAAe,GAAG;;;;;YACR,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,SAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mCAAI,IAAI,CAAC;YAC3C,IAAI,SAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;YAG3C,IAAI,CAAC,IAAI,CAAC,gCAA8B,GAAK,CAAC,CAAC;YAG/C,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;YAGxC,WAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;iBAC1B,IAAI,CAAC,UAAC,GAAG;gBAER,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEzC,IAAI,CAAC,IAAI,CAAC,2BAAyB,GAAG,CAAC,MAAQ,CAAC,CAAC;gBAEjD,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;YACzC,CAAC,CAAC;iBACD,KAAK,CAAC,UAAC,GAAG;gBAET,IAA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ED,GAAG,EAAE,CAAC"}

Binary file not shown.

Binary file not shown.

View File

@ -2,9 +2,9 @@ import * as core from '@actions/core';
import { http } from './http';
async function run() {
const url = core.getInput('url');
const headers = core.getInput('headers') ?? null;
const body = core.getInput('body') ?? null;
const url = core.getInput('url') ?? process.env.WEBHOOK_URL;
const headers = core.getInput('headers') ?? process.env.HEADERS ?? null;
const body = core.getInput('body') ?? process.env.data ?? null;
// initial info
core.info(`Sending webhook request to ${url}`);