Skip to content

Commit

Permalink
Fix compile errors
Browse files Browse the repository at this point in the history
1. Name conflict from changing TOO_MANY_FILES to tooManyFiles. Renamed
again.
2. Placeholder tsconfig for mergebot test doesn't exist. There is no
separate tconfig for tests!
  • Loading branch information
sandersn committed Jul 1, 2024
1 parent cc7af30 commit 0a14c1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/mergebot/src/pr-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { getMonthlyDownloadCount } from "./util/npm";
import { fetchFile as defaultFetchFile } from "./util/fetchFile";
import { noNullish, someLast, sameUser, authorNotBot, max, abbrOid } from "./util/util";
import { tooManyFiles } from "./queries/pr-query";
import { fileLimit } from "./queries/pr-query";
import * as comment from "./util/comment";
import * as urls from "./urls";
import * as OldHeaderParser from "@definitelytyped/old-header-parser";
Expand Down Expand Up @@ -211,14 +211,14 @@ export async function deriveStateForPR(
// be correct; so to be safe: check it, and warn if there are many files (or zero)
const tooManyFiles =
!fileCount || // should never happen, make it look fishy if it does
fileCount > tooManyFiles || // suspiciously many files
fileCount > fileLimit || // suspiciously many files
fileCount !== prInfo.files?.nodes?.length; // didn't get all files (probably too many)
const hugeChange = prInfo.additions + prInfo.deletions > 5000;

const paths = noNullish(prInfo.files?.nodes)
.map((f) => f.path)
.sort();
if (paths.length > tooManyFiles) paths.length = tooManyFiles; // redundant, but just in case
if (paths.length > fileLimit) paths.length = fileLimit; // redundant, but just in case
const pkgInfoEtc = await getPackageInfosEtc(paths, prInfo.headRefOid, baseId, fetchFile, async (name) =>
getDownloads(name, lastPushDate),
);
Expand Down
4 changes: 2 additions & 2 deletions packages/mergebot/src/queries/pr-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PR, PRVariables, PR_repository_pullRequest_files_nodes } from "./schema
import { PRFiles, PRFilesVariables } from "./schema/PRFiles";
import { noNullish } from "../util/util";

export const tooManyFiles = 500;
export const fileLimit = 500;

// Note: If you want to work on this in local a copy of GraphiQL:
// - Download the electron app: https://github.com/skevy/graphiql-app/releases
Expand Down Expand Up @@ -273,7 +273,7 @@ async function getPRInfoRest(
const newFiles = result.data.repository?.pullRequest?.files;
if (!newFiles) return;
files.push(...noNullish(newFiles.nodes));
if (files.length >= tooManyFiles || !newFiles.pageInfo.hasNextPage) return;
if (files.length >= fileLimit || !newFiles.pageInfo.hasNextPage) return;
endCursor = newFiles.pageInfo.endCursor;
}
}
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
{ "path": "packages/publisher/test" },
{ "path": "packages/typescript-versions/test" },
{ "path": "packages/typescript-packages/test" },
{ "path": "packages/utils/test" },
{ "path": "packages/mergebot/test" }
{ "path": "packages/utils/test" }
]
}

0 comments on commit 0a14c1f

Please sign in to comment.