Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 890fc4b

Browse files
committed
Fix re-running of queries in pr-info
Previously, I changed it to re-run the query if `mergeable` is `UNKNOWN` because it sometimes takes a few seconds for the GH api to update this information. Turns out that this should be done *only* for PRs that are `OPEN`, in other states (`CLOSED` & `MERGED`) it's *expected* to be `UNKNOWN`. This broke the removal of project cards for closed/merged PRs, since it would just spin the 5 retries while getting `UNKNOWN` every time, eventually treating it as bogus (and also timing out the gateway). Should fix #278.
1 parent 4dd6f17 commit 890fc4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pr-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export async function queryPRInfo(prNumber: number) {
183183
});
184184
const prInfo = info.data.repository?.pullRequest;
185185
if (!prInfo) return info; // let `deriveStateForPR` handle the missing result
186-
if (prInfo.mergeable !== "UNKNOWN") return info;
186+
if (!(prInfo.state === "OPEN" && prInfo.mergeable === "UNKNOWN")) return info;
187187
const { nodes, totalCount } = prInfo.files!;
188188
if (nodes!.length < totalCount) console.warn(` *** Note: ${totalCount - nodes!.length} files were not seen by this query!`);
189189
if (++retries > 5) { // we already did 5 tries, so give up and...

0 commit comments

Comments
 (0)