我已经使用GitHub probot
和nodejs
创建了一个typescript
应用。我正在听pull_request
事件。如何从probot pr_number
对象中检索context
?
以下是intex.ts
export = (app: Application) => {
app.on('pull_request', async (context) => {
})
}
答案 0 :(得分:1)
您感兴趣的字段是回调中的context.payload
:
export = (app: Application) => {
app.on('pull_request', async (context) => {
const payload = context.payload
// ...
})
}
这与GitHub Webhook事件页面中列出的有效负载相匹配: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
})
}