我已经使用nodejs和typescript创建了一个GitHub probot应用程序。我正在收听pull_request事件。如何从probot context对象中检索pr_number?
以下是intex.ts中的代码
export = (app: Application) => {
app.on('pull_request', async (context) => {
})
}发布于 2019-04-10 02:08:34
您感兴趣的字段是回调中的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
})
}https://stackoverflow.com/questions/55597173
复制相似问题