ERROR事件:找不到;当从另一个事件触发事件时:nodejs中内置的probot应用程序



我正在probot和nodejs中构建一个GitHub应用程序,并试图在pull_request.synchronize事件发生时更新PR。我知道这没有多大意义,但关键是我希望能够在某个事件发生时更新公关。

app.on('pull_request.synchronize', async context => {
console.log('---------------------- on pull_request.synchronize, body of PR : ', context.payload.pull_request)
console.log('State of PR after pull_request.synchronize event :---------------', context.payload.pull_request.state)
await context.github.pulls.update({
owner:context.payload.repository.owner,
repo :context.payload.repository.name,
pull_number :context.payload.pull_request.number,
title:'updated Pull Request Title: Success',
body:'updated Pull Request Body: Success',
})
})

我每次都会得到以下错误:

ERROR event: Not Found (id=ssjsk-dd-sdfsdfs-fsfs-fsfsfsffsd)
HttpError: Not Found
at response.text.then.message (C:GitWorkspaceuserGitHubAppsgithub-app-namenode_modules@octokitrequestdist-nodeindex.js:66:23)
at process._tickCallback (internal/process/next_tick.js:68:7)
--
event: {
"event": "pull_request.synchronize",
"id": "2332-3131-131-31231313-1313232144142",
"installation": 3352243,
"repository": "user/Demo-Repo"
}
06:24:58.460Z ERROR probot: Not Found
HttpError: Not Found
at response.text.then.message (C:GitWorkspaceuserGitHubAppsgithub-app-namenode_modules@octokitrequestdist-nodeindex.js:66:23)
at process._tickCallback (internal/process/next_tick.js:68:7)
06:24:58.472Z  INFO http: POST / 500 - 519.93 ms (id=3424234-43242-42423478a-4242-42342342)
06:24:58.476Z ERROR probot: Internal Server Error
Error: Internal Server Error
at Request.callback (C:GitWorkspaceuserGitHubAppsgithub-app-namenode_modulessuperagentlibnodeindex.js:706:15)
at IncomingMessage.parser (C:GitWorkspaceuserGitHubAppsgithub-app-namenode_modulessuperagentlibnodeindex.js:916:18)
at IncomingMessage.emit (events.js:203:15)
at IncomingMessage.EventEmitter.emit (domain.js:448:20)
at endReadableNT (_stream_readable.js:1129:12)
at process._tickCallback (internal/process/next_tick.js:63:19)

为什么它无法断章取义地获取详细信息,而事实上上下文确实是由我的控制台语句打印出来的,并且包含pull_request详细信息。

我只是probot和nodejs的初学者,所以我不确定这是否与语法有关。

问题是context.payload.repository.owner是一个对象,请在https://developer.github.com/v3/activity/events/types/#webhook-有效载荷-样本-28

尝试将其替换为context.payload.repository.owner.login

Probot还提供了一种方便的方法,可以根据上下文返回和{ owner, repo }对象,并且可以向它传递额外的参数

尝试以下

await context.github.pulls.update(context.repo({
pull_number: context.payload.pull_request.number,
title:'updated Pull Request Title: Success',
body:'updated Pull Request Body: Success',
}))

相关内容

  • 没有找到相关文章

最新更新