diff --git a/server/app/query/create/page.tsx b/server/app/query/create/page.tsx index 490542f..832b9d1 100644 --- a/server/app/query/create/page.tsx +++ b/server/app/query/create/page.tsx @@ -217,7 +217,7 @@ function IPAForm({ > { - const requestParams: any = { + const branchesRequestParams: any = { owner: owner, repo: repo, per_page: 100, @@ -35,7 +35,7 @@ export async function Branches( }; const branchesIter = octokit.paginate.iterator( octokit.rest.repos.listBranches, - requestParams, + branchesRequestParams, ); let branchesArray: Branch[] = []; @@ -47,6 +47,32 @@ export async function Branches( }); } } + + const pullsRequestParams: any = { + owner: owner, + repo: repo, + state: "open", + per_page: 100, + request: { + cache: bypassCache ? "reload" : "default", + }, + timestamp: new Date().getTime(), + }; + + const pullRequestsIter = octokit.paginate.iterator( + octokit.rest.pulls.list, + pullsRequestParams, + ); + + for await (const { data: pullRequests } of pullRequestsIter) { + for (const pullRequest of pullRequests) { + branchesArray.push({ + name: `#${pullRequest.number}: ${pullRequest.title}`, + commitHash: pullRequest.head.sha.substring(0, 7), + }); + } + } + const mainBranchIndex = branchesArray.findIndex( (branch) => branch.name === "main", ); diff --git a/server/app/query/view/[id]/components.tsx b/server/app/query/view/[id]/components.tsx index 75c4a38..1d49102 100644 --- a/server/app/query/view/[id]/components.tsx +++ b/server/app/query/view/[id]/components.tsx @@ -103,6 +103,15 @@ export function LogViewer({ {log.logLine} ))} +
+ {">_"} +
); diff --git a/sidecar/app/query/ipa.py b/sidecar/app/query/ipa.py index 8e3e43a..0d7f2ed 100644 --- a/sidecar/app/query/ipa.py +++ b/sidecar/app/query/ipa.py @@ -64,6 +64,26 @@ def pre_run(self): self.skip = True +@dataclass(kw_only=True) +class IPAUpdateRemoteOriginStep(LoggerOutputCommandStep): + repo_path: Path + status: ClassVar[Status] = Status.STARTING + + @classmethod + def build_from_query(cls, query: IPAQuery): + return cls( + repo_path=query.paths.repo_path, + logger=query.logger, + ) + + def build_command(self) -> LoggerOutputCommand: + return LoggerOutputCommand( + cmd=f"git -C {self.repo_path} config --add remote.origin.fetch " + "'+refs/pull/*/head:refs/remotes/origin/pr/*'", + logger=self.logger, + ) + + @dataclass(kw_only=True) class IPAFetchUpstreamStep(LoggerOutputCommandStep): repo_path: Path @@ -388,6 +408,7 @@ class IPAHelperQuery(IPAQuery): step_classes: ClassVar[list[type[Step]]] = [ IPACloneStep, + IPAUpdateRemoteOriginStep, IPAFetchUpstreamStep, IPACheckoutCommitStep, IPAHelperCompileStep,