diff --git a/studio/components/interfaces/BranchManagement/BranchManagement.tsx b/studio/components/interfaces/BranchManagement/BranchManagement.tsx
index f846b7c3241..43747e3daad 100644
--- a/studio/components/interfaces/BranchManagement/BranchManagement.tsx
+++ b/studio/components/interfaces/BranchManagement/BranchManagement.tsx
@@ -70,6 +70,10 @@ const BranchManagement = () => {
} = useBranchesQuery({ projectRef })
const [[mainBranch], previewBranches] = partition(branches, (branch) => branch.is_default)
const branchesWithPRs = previewBranches.filter((branch) => branch.pr_number !== undefined)
+ const prNumbers =
+ branches !== undefined
+ ? (branchesWithPRs.map((branch) => branch.pr_number).filter(Boolean) as number[])
+ : undefined
const githubIntegration = integrations?.find(
(integration) =>
@@ -92,7 +96,7 @@ const BranchManagement = () => {
organizationIntegrationId: githubIntegration?.id,
repoOwner,
repoName,
- target: mainBranch?.git_branch,
+ prNumbers,
})
const pullRequests = allPullRequests ?? []
diff --git a/studio/components/interfaces/BranchManagement/BranchPanels.tsx b/studio/components/interfaces/BranchManagement/BranchPanels.tsx
index 47d0597a03c..d8ab75c738c 100644
--- a/studio/components/interfaces/BranchManagement/BranchPanels.tsx
+++ b/studio/components/interfaces/BranchManagement/BranchPanels.tsx
@@ -139,6 +139,7 @@ export const BranchRow = ({
)}
+
{isMain ? (
}>
diff --git a/studio/data/api.d.ts b/studio/data/api.d.ts
index f0321f3a6e2..f799582b862 100644
--- a/studio/data/api.d.ts
+++ b/studio/data/api.d.ts
@@ -4763,40 +4763,6 @@ export interface components {
extensionId: string
items: components['schemas']['ResourceBillingItem'][]
}
- ResourceProvisioningBody: {
- /** @description A UNIX epoch timestamp value */
- timestamp: number
- /** @description A random unique string identifying the individual request */
- nonce: string
- /** @description The full request target URL */
- url: string
- /** @description Name of the extension */
- name: string
- /** @description Unique ID representing the extension */
- id: string
- /** @description Unique ID representing an organization */
- organization_id: string
- /** @description Display name for an organization */
- organization_name: string
- /** @description Obfuscated email that routes to all organization admins */
- organization_email: string
- /** @description Obfuscated email that routes to the provisioning user */
- user_email: string
- /** @description Unique ID representing an user */
- user_id: string
- /** @description The three-letter, primary Fly.io region where the target app intends to write from */
- primary_region: string
- /** @description An IPv6 address on the customer network assigned to this extension */
- ip_address: string
- /**
- * @description An array of Fly.io region codes where read replicas should be provisioned
- * @default []
- */
- read_regions: string[]
- /** @description Database password (Optional, don't send to generate one) */
- db_pass?: string
- user_name: string
- }
ResourceProvisioningConfigResponse: {
/**
* @description PSQL connection string
@@ -12340,11 +12306,6 @@ export interface operations {
}
/** Creates a database */
ExtensionsController_provisionResource: {
- requestBody: {
- content: {
- 'application/json': components['schemas']['ResourceProvisioningBody']
- }
- }
responses: {
201: {
content: {
diff --git a/studio/data/integrations/integrations-github-pull-requests-query.ts b/studio/data/integrations/integrations-github-pull-requests-query.ts
index acc3ca168d6..326cc548f00 100644
--- a/studio/data/integrations/integrations-github-pull-requests-query.ts
+++ b/studio/data/integrations/integrations-github-pull-requests-query.ts
@@ -8,27 +8,30 @@ export type GithubPullRequestsVariables = {
organizationIntegrationId?: string
repoOwner: string
repoName: string
- target?: string
+ prNumbers?: number[]
}
export type GitHubPullRequest = components['schemas']['GetGithubPullRequest']
export async function getGitHubPullRequests(
- { organizationIntegrationId, repoOwner, repoName, target }: GithubPullRequestsVariables,
+ { organizationIntegrationId, repoOwner, repoName, prNumbers }: GithubPullRequestsVariables,
signal?: AbortSignal
) {
if (!organizationIntegrationId) throw new Error('Organization integration ID is required')
- if (!target) throw new Error('Target branch is required')
+ if (!prNumbers) throw new Error('A list of PR numbers is required')
const { data, error } = await get(
- `/platform/integrations/github/pull-requests/{organization_integration_id}/{repo_owner}/{repo_name}/{target}`,
+ `/platform/integrations/github/pull-requests/{organization_integration_id}/{repo_owner}/{repo_name}`,
{
params: {
path: {
organization_integration_id: organizationIntegrationId,
repo_owner: repoOwner,
repo_name: repoName,
- target,
+ },
+ query: {
+ // @ts-ignore generated api types is incorrect here, to remove ignore statement once fixed
+ pr_number: prNumbers,
},
},
signal,
@@ -43,23 +46,24 @@ export type GithubPullRequestsData = Awaited(
- { organizationIntegrationId, repoOwner, repoName, target }: GithubPullRequestsVariables,
+ { organizationIntegrationId, repoOwner, repoName, prNumbers }: GithubPullRequestsVariables,
{
enabled = true,
...options
}: UseQueryOptions = {}
) =>
useQuery(
- integrationKeys.githubPullRequestsList(organizationIntegrationId, repoOwner, repoName, target),
+ // [Joshen] Just fyi im not sure if we need to include prNumber in the RQ key here
+ integrationKeys.githubPullRequestsList(organizationIntegrationId, repoOwner, repoName),
({ signal }) =>
- getGitHubPullRequests({ organizationIntegrationId, repoOwner, repoName, target }, signal),
+ getGitHubPullRequests({ organizationIntegrationId, repoOwner, repoName, prNumbers }, signal),
{
enabled:
enabled &&
typeof organizationIntegrationId !== 'undefined' &&
typeof repoOwner !== 'undefined' &&
typeof repoName !== 'undefined' &&
- typeof target !== 'undefined',
+ typeof prNumbers !== 'undefined',
...options,
}
)
diff --git a/studio/data/integrations/keys.ts b/studio/data/integrations/keys.ts
index ae8cdf03c13..d45a653c2ba 100644
--- a/studio/data/integrations/keys.ts
+++ b/studio/data/integrations/keys.ts
@@ -29,16 +29,8 @@ export const integrationKeys = {
githubPullRequestsList: (
organization_integration_id: string | undefined,
repo_owner: string,
- repo_name: string,
- target: string | undefined
- ) => [
- 'organizations',
- organization_integration_id,
- 'pull-requests',
- repo_owner,
- repo_name,
- target,
- ],
+ repo_name: string
+ ) => ['organizations', organization_integration_id, 'pull-requests', repo_owner, repo_name],
githubConnectionsList: (organization_integration_id: string | undefined) =>
['organizations', organization_integration_id, 'github-connections'] as const,
}