-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add classes, object_oriented code
- Loading branch information
1 parent
93a0f41
commit 9096cdf
Showing
20 changed files
with
448 additions
and
234 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 |
---|---|---|
@@ -1,9 +1,6 @@ | ||
# The ID of your GitHub App | ||
APP_ID= | ||
WEBHOOK_SECRET=development | ||
|
||
# Use `trace` to get verbose logging or `info` to show less | ||
LOG_LEVEL=debug | ||
|
||
# Go to https://smee.io/new set this to the URL that you are redirected to. | ||
WEBHOOK_PROXY_URL= | ||
WEBHOOK_PROXY_URL=https://smee.io/... | ||
APP_ID=... | ||
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n......-----END RSA PRIVATE KEY-----\n" | ||
WEBHOOK_SECRET=.... | ||
GITHUB_CLIENT_ID=Iv23ct.... | ||
GITHUB_CLIENT_SECRET=... |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
File renamed without changes.
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 |
---|---|---|
@@ -1,25 +1,24 @@ | ||
import bodyParser from "body-parser"; | ||
import issue_comment_created from "./handlers/issue_comment_created.js"; | ||
import issue_opened from "./handlers/issue_opened.js"; | ||
import { | ||
IssueCommentHandler, | ||
IssueOpenerHandler, | ||
} from "./classes/event_handler.js"; | ||
import routes from "./routes/routes.js"; | ||
|
||
export default async (app, { getRouter }) => { | ||
const router = getRouter("/issue-assigner"); | ||
router.use(bodyParser.json()); | ||
router.get("/", async (req, res) => { | ||
res.status(200).send("Welcome to Issue Assigner"); | ||
}); | ||
// Define routes of server | ||
routes(getRouter); | ||
|
||
router.post("/webhook", (req, res) => { | ||
console.log("Webhook from marketplace: ", req.body); | ||
res.status(200).json({ success: "Webhook received successfully" }); | ||
}); | ||
/* Webhooks received */ | ||
|
||
// Issue opened by a user | ||
app.on("issues.opened", issue_opened); | ||
app.on("issues.opened", async (context) => { | ||
const issueOpenerHandlerObj = new IssueOpenerHandler(context); | ||
await issueOpenerHandlerObj.handleEvent(); | ||
}); | ||
|
||
// Comment is created in an issue by a user | ||
app.on( | ||
["issue_comment.created", "issue_comment.edited"], | ||
issue_comment_created | ||
); | ||
app.on(["issue_comment.created", "issue_comment.edited"], async (context) => { | ||
const issueCommentHandlerObj = new IssueCommentHandler(context); | ||
await issueCommentHandlerObj.handleEvent(); | ||
}); | ||
}; |
Oops, something went wrong.