mirror of https://github.com/buster-so/buster.git
remove logging statements
This commit is contained in:
parent
d7e3eb5351
commit
6a8c75e59b
|
@ -3,7 +3,6 @@ import { HTTPException } from 'hono/http-exception';
|
||||||
import { githubWebhookMiddleware } from '../../../../../middleware/github-webhook-middleware';
|
import { githubWebhookMiddleware } from '../../../../../middleware/github-webhook-middleware';
|
||||||
|
|
||||||
const app = new Hono().post('/', githubWebhookMiddleware(), async (c) => {
|
const app = new Hono().post('/', githubWebhookMiddleware(), async (c) => {
|
||||||
console.info('GitHub webhook POST');
|
|
||||||
const githubApp = c.get('githubApp');
|
const githubApp = c.get('githubApp');
|
||||||
if (!githubApp) {
|
if (!githubApp) {
|
||||||
throw new HTTPException(400, {
|
throw new HTTPException(400, {
|
||||||
|
@ -17,7 +16,7 @@ const app = new Hono().post('/', githubWebhookMiddleware(), async (c) => {
|
||||||
const issue_number = payload.pull_request.number;
|
const issue_number = payload.pull_request.number;
|
||||||
const username = payload.pull_request.user.login;
|
const username = payload.pull_request.user.login;
|
||||||
console.info(`Pull request opened by ${username} in ${owner}/${repo}#${issue_number}`);
|
console.info(`Pull request opened by ${username} in ${owner}/${repo}#${issue_number}`);
|
||||||
const body = 'Thank you for your pull request!';
|
const body = 'Merge if you are stinky!';
|
||||||
return octokit.rest.issues.createComment({
|
return octokit.rest.issues.createComment({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
|
|
|
@ -26,11 +26,9 @@ function getOrSetApp() {
|
||||||
*/
|
*/
|
||||||
export function githubWebhookMiddleware(): MiddlewareHandler {
|
export function githubWebhookMiddleware(): MiddlewareHandler {
|
||||||
return async (c: Context, next) => {
|
return async (c: Context, next) => {
|
||||||
console.info('GitHub webhook middleware');
|
|
||||||
try {
|
try {
|
||||||
const githubApp = getOrSetApp();
|
const githubApp = getOrSetApp();
|
||||||
c.set('githubApp', githubApp);
|
c.set('githubApp', githubApp);
|
||||||
console.info('GitHubapp set');
|
|
||||||
|
|
||||||
const id = c.req.header('x-github-delivery');
|
const id = c.req.header('x-github-delivery');
|
||||||
const signature = c.req.header('x-hub-signature-256');
|
const signature = c.req.header('x-hub-signature-256');
|
||||||
|
@ -45,13 +43,12 @@ export function githubWebhookMiddleware(): MiddlewareHandler {
|
||||||
|
|
||||||
await next();
|
await next();
|
||||||
|
|
||||||
const result = await githubApp.webhooks.verifyAndReceive({
|
await githubApp.webhooks.verifyAndReceive({
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
payload,
|
payload,
|
||||||
signature,
|
signature,
|
||||||
});
|
});
|
||||||
console.info('GitHub webhook result:', result);
|
|
||||||
|
|
||||||
return c.text('Webhook received & verified', 201);
|
return c.text('Webhook received & verified', 201);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue