-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ce22702
Showing
9 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM node:17-alpine | ||
|
||
COPY dist/lawg.js dist/lawg.js | ||
|
||
CMD ["node", "/dist/lawg.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Lawg Github Action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish Lawg Event | ||
description: Send events to Lawg | ||
|
||
author: Lawg | ||
|
||
branding: | ||
color: gray-dark | ||
icon: zap | ||
|
||
inputs: | ||
token: | ||
description: Lawg API Token | ||
required: true | ||
|
||
project: | ||
description: Project Namespace | ||
required: true | ||
|
||
feed: | ||
description: Project Feed | ||
required: true | ||
|
||
title: | ||
description: Event Title | ||
required: true | ||
|
||
description: | ||
description: Event Description | ||
required: false | ||
|
||
icon: | ||
description: Event Emoji | ||
required: false | ||
|
||
notify: | ||
description: Send a notification? | ||
default: false | ||
|
||
runs: | ||
using: docker | ||
image: Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core_1 = __importDefault(require("@actions/core")); | ||
function run() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const URL = `https://api.lawg.dev/v1/projects/${process.env.LAWG_PROJECT}/feeds/${process.env.LAWG_FEED}/events`; | ||
try { | ||
return fetch(URL, { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
title: process.env.LAWG_TITLE, | ||
description: process.env.LAWG_DESCRIPTION, | ||
icon: process.env.LAWG_ICON, | ||
notify: process.env.LAWG_NOTIFY, | ||
}), | ||
headers: { | ||
Authorization: process.env.LAWG_TOKEN, | ||
"Content-Type": "application/json", | ||
}, | ||
}).then((res) => { | ||
if (res.status === 200) { | ||
core_1.default.setOutput("output", "Successfully created your event!"); | ||
} | ||
}); | ||
} | ||
catch (error) { | ||
if (error instanceof Error) | ||
core_1.default.setFailed(error.message); | ||
} | ||
}); | ||
} | ||
run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "lawg-action", | ||
"version": "0.0.1", | ||
"scripts": { | ||
"build": "tsc" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.4.1", | ||
"typescript": "^5.1.6" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "^1.10.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import core from "@actions/core"; | ||
|
||
async function run() { | ||
const URL = `https://api.lawg.dev/v1/projects/${process.env.LAWG_PROJECT}/feeds/${process.env.LAWG_FEED}/events`; | ||
|
||
try { | ||
return fetch(URL, { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
title: process.env.LAWG_TITLE, | ||
description: process.env.LAWG_DESCRIPTION, | ||
icon: process.env.LAWG_ICON, | ||
notify: process.env.LAWG_NOTIFY, | ||
}), | ||
headers: { | ||
Authorization: process.env.LAWG_TOKEN as string, | ||
"Content-Type": "application/json", | ||
}, | ||
}).then((res) => { | ||
if (res.status === 200) { | ||
core.setOutput("output", "Successfully created your event!"); | ||
} | ||
}); | ||
} catch (error) { | ||
if (error instanceof Error) core.setFailed(error.message); | ||
} | ||
} | ||
|
||
run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"module": "commonjs", | ||
"outDir": "./dist", | ||
"rootDir": "./src", | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"esModuleInterop": true | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@actions/core@^1.10.0": | ||
version "1.10.0" | ||
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.0.tgz#44551c3c71163949a2f06e94d9ca2157a0cfac4f" | ||
integrity sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug== | ||
dependencies: | ||
"@actions/http-client" "^2.0.1" | ||
uuid "^8.3.2" | ||
|
||
"@actions/http-client@^2.0.1": | ||
version "2.1.0" | ||
resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.1.0.tgz#b6d8c3934727d6a50d10d19f00a711a964599a9f" | ||
integrity sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw== | ||
dependencies: | ||
tunnel "^0.0.6" | ||
|
||
"@types/node@^20.4.1": | ||
version "20.4.1" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.1.tgz#a6033a8718653c50ac4962977e14d0f984d9527d" | ||
integrity sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg== | ||
|
||
tunnel@^0.0.6: | ||
version "0.0.6" | ||
resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" | ||
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== | ||
|
||
typescript@^5.1.6: | ||
version "5.1.6" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" | ||
integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== | ||
|
||
uuid@^8.3.2: | ||
version "8.3.2" | ||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" | ||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== |