Skip to content

Commit

Permalink
fix(probot): passes logger to webhooks (#2010)
Browse files Browse the repository at this point in the history
* test(probot): passes logger to webhooks

* fix(probot): passes logger to webhooks
  • Loading branch information
gr2m committed May 1, 2024
1 parent 5f0ca04 commit 3dcb058
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/octokit/get-webhooks.ts
Expand Up @@ -11,6 +11,7 @@ export function getWebhooks(state: State) {
// > The context of the event that was triggered, including the payload and
// helpers for extracting information can be passed to GitHub API calls
const webhooks = new Webhooks({
log: state.log,
secret: state.webhooks.secret!,
transform: webhookTransform.bind(null, state),
});
Expand Down
16 changes: 16 additions & 0 deletions test/probot.test.ts
Expand Up @@ -625,5 +625,21 @@ describe("Probot", () => {
expect(error.message).toMatch(/error from app/);
}
});

it.only("passes logger to webhooks", async () => {
const probot = new Probot({
appId,
privateKey,
log: pino(streamLogsToOutput),
});

// @ts-expect-error
probot.on("unknown-event", () => {});

expect(output.length).toEqual(1);
expect(output[0].msg).toEqual(
'"unknown-event" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)'
);
});
});
});

0 comments on commit 3dcb058

Please sign in to comment.