From f92be38e7b9fab5156af81f5cb7d159afd5d95b2 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 21 Oct 2026 18:19:10 -0400 Subject: [PATCH] chore: Replace deprecated @octokit/webhooks-types with @octokit/openapi-webhooks-types (#14203) --- package.json | 2 +- plugins/github/server/GitHubIssueProvider.ts | 22 +++++++++++++++----- yarn.lock | 16 +++++++------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 88a569f78d..97def94831 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "@node-oauth/oauth2-server": "^5.3.0", "@notionhq/client": "^2.3.0", "@octokit/auth-app": "^8.3.1", - "@octokit/webhooks-types": "^7.6.1", + "@octokit/openapi-webhooks-types": "^12.2.0", "@outlinewiki/koa-passport": "^4.2.1", "@outlinewiki/passport-azure-ad-oauth2": "^0.1.0", "@radix-ui/react-collapsible": "^1.2.1", diff --git a/plugins/github/server/GitHubIssueProvider.ts b/plugins/github/server/GitHubIssueProvider.ts index 8d39324f31..bc1f86d58f 100644 --- a/plugins/github/server/GitHubIssueProvider.ts +++ b/plugins/github/server/GitHubIssueProvider.ts @@ -1,9 +1,5 @@ import type { Endpoints } from "@octokit/types"; -import type { - InstallationNewPermissionsAcceptedEvent, - InstallationRepositoriesEvent, - RepositoryRenamedEvent, -} from "@octokit/webhooks-types"; +import type { components } from "@octokit/openapi-webhooks-types"; import type { IssueSource } from "@shared/schema"; import type { IntegrationType } from "@shared/types"; import { IntegrationService } from "@shared/types"; @@ -13,6 +9,14 @@ import { sequelize } from "@server/storage/database"; import { BaseIssueProvider } from "@server/utils/BaseIssueProvider"; import { GitHub } from "./github"; +type InstallationNewPermissionsAcceptedEvent = + components["schemas"]["webhook-installation-new-permissions-accepted"]; +type InstallationRepositoriesEvent = + | components["schemas"]["webhook-installation-repositories-added"] + | components["schemas"]["webhook-installation-repositories-removed"]; +type RepositoryRenamedEvent = + components["schemas"]["webhook-repository-renamed"]; + // This is needed to handle Octokit paginate response type mismatch. type ReposForInstallation = Endpoints["GET /installation/repositories"]["response"]["data"]["repositories"]; @@ -153,6 +157,14 @@ export class GitHubIssueProvider extends BaseIssueProvider { const installationId = event.installation.id; const account = event.installation.account; + // Only user and organization accounts own repositories. + if (!account || !("login" in account)) { + Logger.warn( + `GitHub installation_repositories event without user or organization account; installationId: ${installationId}` + ); + return; + } + await sequelize.transaction(async (transaction) => { const integration = await Integration.findOne({ where: { diff --git a/yarn.lock b/yarn.lock index e803ecc137..0ce6c6ea5f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3228,6 +3228,13 @@ __metadata: languageName: node linkType: hard +"@octokit/openapi-webhooks-types@npm:^12.2.0": + version: 12.2.0 + resolution: "@octokit/openapi-webhooks-types@npm:12.2.0" + checksum: 10c0/6a7a403009469f56370f54806e914c5985caa8515bf1137a7c6cba7fb0f26f545d037ce4c8734ad9206eb4087d17f666ec79d633a9bed734d4aebdc94fdd0935 + languageName: node + linkType: hard + "@octokit/plugin-paginate-graphql@npm:^6.0.0": version: 6.0.0 resolution: "@octokit/plugin-paginate-graphql@npm:6.0.0" @@ -3332,13 +3339,6 @@ __metadata: languageName: node linkType: hard -"@octokit/webhooks-types@npm:^7.6.1": - version: 7.6.1 - resolution: "@octokit/webhooks-types@npm:7.6.1" - checksum: 10c0/7c2cb40f9ccd2bd392cf35c23f995ae0719ef35fd3bce0264ced5518cbf0a7087bd069bf5e5963fc33d0232726968db526912df3cb017c1bd1761c8849c31a30 - languageName: node - linkType: hard - "@octokit/webhooks@npm:^14.0.0": version: 14.2.0 resolution: "@octokit/webhooks@npm:14.2.0" @@ -14270,7 +14270,7 @@ __metadata: "@node-oauth/oauth2-server": "npm:^5.3.0" "@notionhq/client": "npm:^2.3.0" "@octokit/auth-app": "npm:^8.3.1" - "@octokit/webhooks-types": "npm:^7.6.1" + "@octokit/openapi-webhooks-types": "npm:^12.2.0" "@outlinewiki/koa-passport": "npm:^4.2.1" "@outlinewiki/passport-azure-ad-oauth2": "npm:^0.1.0" "@radix-ui/react-collapsible": "npm:^1.2.1"