mirror of
https://github.com/outline/outline.git
synced 2026-12-01 01:14:11 +03:00
chore: Replace deprecated @octokit/webhooks-types with @octokit/openapi-webhooks-types (#14203)
This commit is contained in:
1 parent
418752c096
commit
f92be38e7b
3 files changed
+26
-14
No files matched your search
@@ -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: {
|
||||
|
||||
Reference in new issue
Block a user