Skip to content

Commit

Permalink
feat: receive push events
Browse files Browse the repository at this point in the history
  • Loading branch information
sephorah committed Aug 31, 2023
1 parent 83b37d8 commit cac8946
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@chakra-ui/theme-tools": "^2.0.18",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@octokit/app": "14",
"@octokit/app": "^14.0.0",
"@octokit/types": "^11.1.0",
"@octokit/webhooks": "^12.0.3",
"@octokit/webhooks-methods": "^4.0.0",
Expand Down
8 changes: 1 addition & 7 deletions pages/api/program/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,8 @@ const repo_name = "test-bschocolatine";

// This adds an event handler that your code will call later. When this event handler is called, it will log the event to the console. Then, it will use GitHub's REST API to add a comment to the pull request that triggered the event.
async function handlePush({octokit, payload}) {
console.log(`Received a push event for #${payload.push.number}`);

try {
// await octokit.request(`POST /repos/${owner_repo}/${repo_name}/hooks/${appId}/tests`, {
// owner: owner_repo,
// repo: repo_name,
// hook_id: appId
// })
console.log("Received a push event")
} catch (error) {
if (error.response) {
console.error(`Error! Status: ${error.response.status}. Message: ${error.response.data.message}`)
Expand Down

0 comments on commit cac8946

Please sign in to comment.