Skip to content

Commit c3a3a6e

Browse files
committed
fix(github): Include owner in head parameter for PRs from forks
1 parent 1b849bb commit c3a3a6e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

apps/desktop/src/components/ReviewCreation.svelte

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
import { StackPublishingService } from '$lib/history/stackPublishingService';
2828
import { showError, showToast } from '$lib/notifications/toasts';
2929
import { ProjectsService } from '$lib/project/projectsService';
30+
import { RemotesService } from '$lib/remotes/remotesService';
3031
import { StackService } from '$lib/stacks/stackService.svelte';
32+
import { parseRemoteUrl } from '$lib/url/gitUrl';
3133
import { UserService } from '$lib/user/userService';
3234
import { getBranchNameFromRef } from '$lib/utils/branch';
3335
import { sleep } from '$lib/utils/sleep';
@@ -63,6 +65,7 @@
6365
const userService = getContext(UserService);
6466
const templateService = getContext(TemplateService);
6567
const aiService = getContext(AIService);
68+
const remotesService = getContext(RemotesService);
6669
6770
const user = userService.user;
6871
const project = projectsService.getProjectStore(projectId);
@@ -276,12 +279,23 @@
276279
base = branchParent.name;
277280
}
278281
282+
const pushRemoteName = baseBranch.actualPushRemoteName();
283+
const allRemotes = await remotesService.remotes(projectId);
284+
const pushRemote = allRemotes.find((r) => r.name === pushRemoteName);
285+
const pushRemoteUrl = pushRemote?.url;
286+
287+
const repoInfo = parseRemoteUrl(pushRemoteUrl);
288+
289+
const upstreamName = repoInfo?.owner
290+
? `${repoInfo.owner}:${params.upstreamBranchName}`
291+
: params.upstreamBranchName;
292+
279293
const pr = await prService.createPr({
280294
title: params.title,
281295
body: params.body,
282296
draft: params.draft,
283297
baseBranchName: base,
284-
upstreamName: params.upstreamBranchName
298+
upstreamName
285299
});
286300
287301
// Store the new pull request number with the branch data.

0 commit comments

Comments
 (0)