错误事件:未找到;从另一个事件触发事件时:在 nodejs 中构建的 probot 应用程序
ERROR event: Not Found; when triggering event from another event : probot app built in nodejs
我正在 probot 和 nodejs 中构建一个 GitHub 应用程序,并尝试在 pull_request.synchronize 事件发生时更新 PR。我知道这没有多大意义,但关键是我希望能够在某个事件发生时更新 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:\GitWorkspace\user\GitHubApps\github-app-name\node_modules\@octokit\request\dist-node\index.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:\GitWorkspace\user\GitHubApps\github-app-name\node_modules\@octokit\request\dist-node\index.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:\GitWorkspace\user\GitHubApps\github-app-name\node_modules\superagent\lib\node\index.js:706:15)
at IncomingMessage.parser (C:\GitWorkspace\user\GitHubApps\github-app-name\node_modules\superagent\lib\node\index.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-payload-example-28
处的示例负载
尝试将其替换为context.payload.repository.owner.login
。
Probot还提供了一个方便的方法returns和{ 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',
}))
我正在 probot 和 nodejs 中构建一个 GitHub 应用程序,并尝试在 pull_request.synchronize 事件发生时更新 PR。我知道这没有多大意义,但关键是我希望能够在某个事件发生时更新 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:\GitWorkspace\user\GitHubApps\github-app-name\node_modules\@octokit\request\dist-node\index.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:\GitWorkspace\user\GitHubApps\github-app-name\node_modules\@octokit\request\dist-node\index.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:\GitWorkspace\user\GitHubApps\github-app-name\node_modules\superagent\lib\node\index.js:706:15)
at IncomingMessage.parser (C:\GitWorkspace\user\GitHubApps\github-app-name\node_modules\superagent\lib\node\index.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-payload-example-28
尝试将其替换为context.payload.repository.owner.login
。
Probot还提供了一个方便的方法returns和{ 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',
}))