From 84bf1fb89c41dde5025ebb5d5e553bb056f196c7 Mon Sep 17 00:00:00 2001 From: Tobias Wilken Date: Sat, 15 Nov 2025 13:32:32 +0100 Subject: [PATCH] fix: webhook handler GitHubClient instantiation The webhook handler was passing installationId directly to getPullRequestData() instead of creating a GitHubClient instance. This caused webhooks to fail with "githubClient.getPullRequest is not a function" error. Updated processPullRequest() to: - Import Auth and GitHubClient classes - Create Auth instance with owner/repo - Create GitHubClient instance with Auth - Pass GitHubClient to getPullRequestData() This matches the working pattern in pullRequestProcessor.js. Closes #312 --- src/helpers/webhookHandler.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/helpers/webhookHandler.js b/src/helpers/webhookHandler.js index 4806950..ed7dfd8 100644 --- a/src/helpers/webhookHandler.js +++ b/src/helpers/webhookHandler.js @@ -2,6 +2,8 @@ import { getPullRequestData } from './pullRequest.js'; import { setCommitStatus, getLatestCommitSha } from './github.js'; import { updateOrCreateWorlddrivenComment } from './commentManager.js'; import { Repository } from '../database/models.js'; +import { Auth } from './auth.js'; +import { GitHubClient } from './github-client.js'; /** * Set GitHub status for a pull request @@ -68,8 +70,12 @@ async function setPullRequestStatus( async function processPullRequest(installationId, owner, repo, pullNumber) { console.log(`Processing PR ${owner}/${repo}#${pullNumber} from webhook`); + // Create Auth and GitHubClient for this repository + const auth = new Auth({ owner, repo }); + const githubClient = new GitHubClient(auth); + const pullRequestData = await getPullRequestData( - installationId, + githubClient, owner, repo, pullNumber