fix(probot): passes logger to webhooks (#2011)

This commit is contained in:
Gregor Martynus 2024-04-30 17:35:38 -07:00 committed by GitHub
parent dbeda67e4a
commit 93007b63c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import { webhookTransform } from "./octokit-webhooks-transform.js";
export function getWebhooks(state: State) {
const webhooks = new Webhooks({
log: state.log,
secret: state.webhooks.secret!,
transform: (hook) => webhookTransform(state, hook),
});

View File

@ -642,5 +642,21 @@ describe("Probot", () => {
expect((error as Error).message).toMatch(/error from app/);
}
});
it("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/)',
);
});
});
});