我使用GitHub probot
和nodejs
创建了一个typescript
应用程序。我正在听pull_request
事件。如何从probot pr_number
对象中检索context
?
以下是intex.ts
中的代码
export = (app: Application) => {
app.on('pull_request', async (context) => {
})
}
你感兴趣的领域是回调中的context.payload
:
export = (app: Application) => {
app.on('pull_request', async (context) => {
const payload = context.payload
// ...
})
}
这与GitHub Webhook Events页面中列出的有效负载相匹配:https://developer.github.com/webhooks/#events
您对pull_request
有效载荷感兴趣,可以在这里找到:https://developer.github.com/v3/activity/events/types/#pullrequestevent
pull_request.number
是您需要的相关信息:
export = (app: Application) => {
app.on('pull_request', async (context) => {
const payload = context.payload
const number = payload.pull_request.number
})
}