Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump @octokit/app from 14.0.0 to 15.1.0 #72

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ module.exports = {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-empty-object-type': 'off',
'import/no-unresolved': 'off',
'import/order': [
'error',
{
Expand Down
5 changes: 1 addition & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const config = {
},
testMatch: ['**/__tests__/**/*.(spec|test).[jt]s?(x)'],
testPathIgnorePatterns: ['<rootDir>/build/', '<rootDir>/node_modules/'],
'//': 'https://github.com/remarkjs/remark/issues/969',
transformIgnorePatterns: [],
collectCoverageFrom: ['src/**/*.{ts,js}'],
coveragePathIgnorePatterns: ['/node_modules/'],
Expand All @@ -22,8 +21,6 @@ const config = {
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
};

if (process.env.CI) {
config.reporters = [['summary', { summaryThreshold: 1 }]];
}
config.reporters = [['summary', { summaryThreshold: 1 }]];

module.exports = config;
2 changes: 1 addition & 1 deletion libs/octo-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"dayjs": "^1.11.9"
},
"peerDependencies": {
"@octokit/rest": "^20.0.1"
"@octokit/rest": "^21.0.2"
}
}
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@
},
"dependencies": {
"@hono/node-server": "^1.11.1",
"@octokit/app": "^14.0.0",
"@octokit/core": "^5.0.0",
"@octokit/rest": "^20.0.1",
"@octokit/webhooks": "^12.0.3",
"@octokit/app": "^15.1.0",
"@octokit/core": "^6.1.2",
"@octokit/rest": "^21.0.2",
"@octokit/webhooks": "^13.3.0",
"@octokit/webhooks-methods": "^5.1.0",
"@opensumi/bot-commander": "workspace:^",
"@opensumi/cfworker-builder": "workspace:^",
"@opensumi/dingtalk-bot": "workspace:^",
Expand All @@ -69,16 +70,16 @@
"@cloudflare/workers-types": "^4.20240620.0",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@octokit/types": "^11.1.0",
"@octokit/webhooks-examples": "^7.3.0",
"@octokit/types": "^13.5.1",
"@octokit/webhooks-examples": "^7.5.1",
"@types/jest": "^29.4.0",
"@types/lodash": "^4.14.191",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.1.0",
"dotenv": "^16.3.1",
"esbuild": "^0.21.4",
"eslint": "^8.32.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-plugin-import": "^2.27.5",
Expand Down
18 changes: 11 additions & 7 deletions src/github/handler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Octokit } from '@octokit/rest';
import { Webhooks } from '@octokit/webhooks';
import {
WebhookEventHandlerError,
Webhooks,
EmitterWebhookEventName,
EmitterWebhookEvent,
} from '@octokit/webhooks';
import type {
WebhookEventHandlerError,
WebhookEventName,
} from '@octokit/webhooks/dist-types/types';
import type { WebhookEventName } from '@octokit/webhooks-types';
import { HonoRequest } from 'hono';

import { error, json } from '@/api/utils/response';
Expand All @@ -21,13 +23,15 @@ import {
import type { Context, IHasSender } from './types';

export class ValidationError extends Error {
constructor(public statusCode: number, message: string) {
constructor(
public statusCode: number,
message: string,
) {
super(message);
}
}

export async function validateGithub(
// eslint-disable-next-line @typescript-eslint/ban-types
req: HonoRequest<any, {}>,
webhooks: Webhooks,
): Promise<EmitterWebhookEvent> {
Expand Down Expand Up @@ -158,12 +162,12 @@ export async function webhookHandler(
} catch (err) {
let status = 500;
if ((err as WebhookEventHandlerError).name === 'AggregateError') {
const statusCode = Array.from(err as WebhookEventHandlerError)[0]
.status;
const statusCode = (err as WebhookEventHandlerError).errors[0].status;
if (statusCode) {
status = statusCode;
}
}

if ((err as any).code) {
status = (err as any).code;
}
Expand Down
7 changes: 3 additions & 4 deletions src/queue/worker/github.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EmitterWebhookEventName, Webhooks } from '@octokit/webhooks';
import { orderBy } from 'lodash';
import chunk from 'lodash/chunk';
import groupBy from 'lodash/groupBy';
import orderBy from 'lodash/orderBy';
import DefaultMap from 'mnemonist/default-map';

import { initApp } from '@/github/app';
Expand Down Expand Up @@ -54,9 +54,8 @@ export class GitHubEventWorker extends BaseWorker<IGitHubEventQueueMessage> {
}

async createGitHubApp(botId: string): Promise<IOctokitShape | undefined> {
const appSetting = await GitHubKVManager.instance().getAppSettingById(
botId,
);
const appSetting =
await GitHubKVManager.instance().getAppSettingById(botId);

if (!appSetting) {
this.logger.error('github app worker error: setting not found', botId);
Expand Down
Loading
Loading