Skip to content

Commit 76b63e0

Browse files
authored
Don't try to update open PRs (#80)
A very rare race case Signed-off-by: Yarden Shoham <[email protected]>
1 parent d6fd787 commit 76b63e0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/github.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ export const fetchBranch = async (branch: string) => {
129129
export const needsUpdate = async (prNumber: number) => {
130130
// get the PR and check if its base sha is the same as its base branch
131131
const pr = await fetchPr(prNumber);
132+
133+
// if the PR is not open, it doesn't need to be updated
134+
if (pr.state !== "open") return false;
135+
132136
const base = await fetchBranch(pr.base.ref);
133137
return pr.base.sha !== base.commit.sha;
134138
};

0 commit comments

Comments
 (0)