Skip to content

Commit

Permalink
Revert "Upgrade next to 14.2.16 (#5756)"
Browse files Browse the repository at this point in the history
This reverts commit ce0896e.
  • Loading branch information
clee2000 authored Nov 8, 2024
1 parent ce0896e commit 5198177
Show file tree
Hide file tree
Showing 9 changed files with 1,365 additions and 1,266 deletions.
5 changes: 3 additions & 2 deletions torchci/components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@ function NavBar() {
<Link
href="https://github.com/pytorch/test-infra/tree/main/torchci"
passHref
style={{ color: "black" }}
>
<AiFillGithub />
<a style={{ color: "black" }}>
<AiFillGithub />
</a>
</Link>
</li>
<li style={{ padding: "0 1rem" }}>
Expand Down
1 change: 0 additions & 1 deletion torchci/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const customJestConfig = {
"@opensearch-project/opensearch/aws":
"@opensearch-project/opensearch/lib/aws/index.js",
},
setupFilesAfterEnv: ["<rootDir>/test/setup.ts"],
};

module.exports = createJestConfig(customJestConfig);
45 changes: 28 additions & 17 deletions torchci/lib/bot/webhookToDynamo.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
import {
EmitterWebhookEvent as WebhookEvent,
EmitterWebhookEventName as WebhookEvents,
} from "@octokit/webhooks";
import { getDynamoClient } from "lib/dynamo";
import { Context, Probot } from "probot";
import { Probot } from "probot";
import { v4 as uuidv4 } from "uuid";

function narrowType<E extends WebhookEvents>(
event: E,
context: WebhookEvent
): context is WebhookEvent<E> {
return context.name === event;
}

async function handleWorkflowJob(
event: Context<"workflow_run" | "workflow_job">
event: WebhookEvent<"workflow_run" | "workflow_job">
) {
// Thre is the chance that job ids from different repos could collide. To
// prevent this, prefix the object key with the repo that they come from.
const key_prefix = event.payload.repository.full_name + "/";

let key;
let table;
let payload;
if (event.name === "workflow_job") {
payload = (event as unknown as Context<"workflow_job">).payload
.workflow_job;
key = `${key_prefix}${payload.id}`;
let table;
if (narrowType("workflow_job", event)) {
key = `${key_prefix}${event.payload.workflow_job.id}`;
payload = event.payload.workflow_job;
table = "torchci-workflow-job";
} else if (event.name === "workflow_run") {
payload = (event as unknown as Context<"workflow_run">).payload
.workflow_run;
key = `${key_prefix}${payload.id}`;
} else if (narrowType("workflow_run", event)) {
key = `${key_prefix}${event.payload.workflow_run.id}`;
payload = event.payload.workflow_run;
table = "torchci-workflow-run";
}

Expand All @@ -34,7 +43,7 @@ async function handleWorkflowJob(
});
}

async function handleIssues(event: Context<"issues">) {
async function handleIssues(event: WebhookEvent<"issues">) {
const key_prefix = event.payload.repository.full_name + "/";
const client = getDynamoClient();

Expand All @@ -47,7 +56,7 @@ async function handleIssues(event: Context<"issues">) {
});
}

async function handleIssueComment(event: Context<"issue_comment">) {
async function handleIssueComment(event: WebhookEvent<"issue_comment">) {
const key_prefix = event.payload.repository.full_name;
const client = getDynamoClient();

Expand All @@ -60,7 +69,7 @@ async function handleIssueComment(event: Context<"issue_comment">) {
});
}

async function handlePullRequest(event: Context<"pull_request">) {
async function handlePullRequest(event: WebhookEvent<"pull_request">) {
const key_prefix = event.payload.repository.full_name + "/";
const client = getDynamoClient();

Expand All @@ -73,7 +82,7 @@ async function handlePullRequest(event: Context<"pull_request">) {
});
}

async function handlePush(event: Context<"push">) {
async function handlePush(event: WebhookEvent<"push">) {
const key_prefix = event.payload.repository.full_name + "/";
const client = getDynamoClient();

Expand All @@ -86,7 +95,9 @@ async function handlePush(event: Context<"push">) {
});
}

async function handlePullRequestReview(event: Context<"pull_request_review">) {
async function handlePullRequestReview(
event: WebhookEvent<"pull_request_review">
) {
const key_prefix = event.payload.repository.full_name;
const client = getDynamoClient();

Expand All @@ -100,7 +111,7 @@ async function handlePullRequestReview(event: Context<"pull_request_review">) {
}

async function handlePullRequestReviewComment(
event: Context<"pull_request_review_comment">
event: WebhookEvent<"pull_request_review_comment">
) {
const key_prefix = event.payload.repository.full_name;
const client = getDynamoClient();
Expand Down
2 changes: 1 addition & 1 deletion torchci/lib/useGroupingPreference.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function usePreference(
// Gets around hydration errors?
useEffect(() => {
setState(initialVal);
}, [initialVal]);
}, []);

return [state, setStatePersist];
}
Expand Down
2 changes: 1 addition & 1 deletion torchci/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/basic-features/typescript for more information.
15 changes: 7 additions & 8 deletions torchci/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@mui/material": "^5.14.1",
"@mui/x-data-grid": "^5.9.0",
"@mui/x-date-pickers": "^5.0.0-alpha.1",
"@octokit/webhooks": "^13.3.0",
"@octokit/webhooks-types": "^7.6.1",
"@octokit/webhooks": "^9.26.3",
"@octokit/webhooks-types": "^6.5.0",
"@opensearch-project/opensearch": "^2.3.1",
"@rockset/client": "^0.8.9",
"@types/minimist": "^1.2.2",
Expand All @@ -42,12 +42,12 @@
"lodash": "^4.17.21",
"minimatch": "^9.0.3",
"minimist": "^1.2.6",
"next": "14.2.16",
"next": "12.1.5",
"next-auth": "^4.24.5",
"octokit": "^1.7.1",
"probot": "^12.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-ga4": "^2.1.0",
"react-icons": "^4.3.1",
"react-linkify-it": "1.0.7",
Expand All @@ -65,7 +65,7 @@
"devDependencies": {
"@types/argparse": "^2.0.10",
"@types/echarts": "^4.9.14",
"@types/jest": "^29.5.14",
"@types/jest": "^27.4.1",
"@types/jsdom": "^16.2.14",
"@types/lodash": "^4.14.182",
"@types/node": "^17.0.40",
Expand All @@ -78,12 +78,11 @@
"dotenv": "^16.0.0",
"eslint": "8.13.0",
"eslint-config-next": "12.1.5",
"jest": "^29.7.0",
"jest": "^27.5.0",
"monaco-editor": "^0.33.0",
"nock": "^13.2.6",
"prettier": "2.6.2",
"prettier-plugin-organize-imports": "^3.2.4",
"ts-jest": "^29.2.5",
"typescript": "4.6.3"
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default async function handler(
}

const { repoOwner, repoName, annotation } = req.query;
const repoOwnerStr = Array.isArray(repoOwner) ? repoOwner[0] : repoOwner!;
const repoNameStr = Array.isArray(repoName) ? repoName[0] : repoName!;
const repoOwnerStr = Array.isArray(repoOwner) ? repoOwner[0] : repoOwner;
const repoNameStr = Array.isArray(repoName) ? repoName[0] : repoName;
const octokit = await getOctokit(repoOwnerStr, repoNameStr);
const user = await octokit.rest.users.getAuthenticated();
const hasPermission = hasWritePermissionsUsingOctokit(
Expand Down
18 changes: 0 additions & 18 deletions torchci/test/setup.ts

This file was deleted.

Loading

0 comments on commit 5198177

Please sign in to comment.