-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (35 loc) · 911 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import express from 'express'
import {limiter} from './src/limiter.js'
import {processWebhook, respond} from './src/routes.js'
import {
debugRequest,
hydrateKey,
hydrateOctokit,
verifyCommand,
verifyGitHubWebhook,
verifyIsPR,
verifyIssueCommentCreatedEvent,
verifyMembership
} from './src/middleware.js'
const app = express()
app.use(express.json())
app.get('/healthz', respond)
app.post('/api/github/webhooks',
debugRequest,
hydrateKey,
limiter,
verifyIsPR,
verifyIssueCommentCreatedEvent,
verifyGitHubWebhook,
verifyMembership,
verifyCommand,
hydrateOctokit,
processWebhook)
const main = async () => {
const port = process.env.OSST_ACTIONS_BOT_PORT || process.env.PORT || 8080
console.log(`Starting server on port ${port}`)
app.listen(port, () => {
console.log(`Server is running on port ${port}`)
})
}
main()