Skip to content

Commit 3bcb0e3

Browse files
fix: Toast message when a duplicate fork from same origin account exist (#122)
* fix: added toast when already a fork from original repo exist in an account. * fix: fixed typo * chore: rephrase --------- Co-authored-by: Silvester <[email protected]>
1 parent ebeb163 commit 3bcb0e3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/api/session.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export async function createSession(octokit, githubConfig, prName) {
5252
} catch (error) {
5353
if (error.status === 404) {
5454
fork = await octokit.rest.repos.createFork({ owner, repo });
55+
if (fork.data.name !== repo) {
56+
throw new Error(
57+
"A fork of the original repository already exists for your account",
58+
);
59+
}
5560
loaderText.innerText = "Creating fork repo...";
5661

5762
// Wait for fork creation to be available and try 3 times

0 commit comments

Comments
 (0)