Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// v1-only. Dies with the v1 UI sunset. Don't evolve this module — v2 already
// resolves PRs via host-service (`packages/host-service/src/runtime/pull-requests`
// backing `git.getPullRequest` + `pullRequests.getByWorkspaces`). Everything
// under `renderer/screens/main/` + `routes/_authenticated/_dashboard/workspace/`
// gets deleted together; no port needed.
import type { CheckItem, GitHubStatus } from "@superset/local-db";
import { execGitWithShellPath } from "../git-client";
import { execWithShellEnv } from "../shell-env";
Expand Down Expand Up @@ -80,14 +85,20 @@ function getForkOwnerPrefix(

export function prMatchesLocalBranch(
localBranch: string,
pr: Pick<GHPRResponse, "headRefName" | "headRepositoryOwner">,
pr: Pick<
GHPRResponse,
"headRefName" | "headRepositoryOwner" | "isCrossRepository"
>,
): boolean {
if (!branchMatchesPR(localBranch, pr.headRefName)) {
return false;
}

const ownerPrefix = getForkOwnerPrefix(localBranch, pr.headRefName);
if (!ownerPrefix) {
// Without a fork-owner prefix in the local branch, a cross-fork PR whose
// headRefName collides (e.g. fork:main → base:main) would misattribute.
if (pr.isCrossRepository) return false;
return localBranch === pr.headRefName;
}

Expand Down
5 changes: 5 additions & 0 deletions packages/host-service/drizzle/0003_workspace_upstream_ref.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DROP INDEX `workspaces_branch_idx`;--> statement-breakpoint
ALTER TABLE `workspaces` ADD `upstream_owner` text;--> statement-breakpoint
ALTER TABLE `workspaces` ADD `upstream_repo` text;--> statement-breakpoint
ALTER TABLE `workspaces` ADD `upstream_branch` text;--> statement-breakpoint
CREATE INDEX `workspaces_upstream_ref_idx` ON `workspaces` (`upstream_owner`,`upstream_repo`,`upstream_branch`);
Loading
Loading