Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: Show Logs button in branching table (#26385)

Kamil Ogórek22b651ab3efe
diff --git a/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx b/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx
index eb074b2d6a3..ad1b2fff215 100644
--- a/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx
+++ b/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx
@@ -103,6 +103,10 @@ export const BranchRow = ({
const createPullRequestURL =
generateCreatePullRequestURL?.(branch.git_branch) ?? 'https://github.com'
+ const shouldRenderLogsButton =
+ branch.pr_number !== undefined && branch.latest_check_run_id !== undefined
+ const checkRunLogsURL = `https://github.com/${repo}/pull/${branch.pr_number}/checks?check_run_id=${branch.latest_check_run_id}`
+
const { ref, inView } = useInView()
const { data } = useBranchQuery(
{ projectRef, id: branch.id },
@@ -259,6 +263,15 @@ export const BranchRow = ({
</Button>
</div>
)}
+
+ {shouldRenderLogsButton && (
+ <Button asChild type="default" iconRight={<IconExternalLink />}>
+ <Link passHref target="_blank" rel="noreferrer" href={checkRunLogsURL}>
+ View Logs
+ </Link>
+ </Button>
+ )}
+
<DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
<Button type="text" icon={<IconMoreVertical />} className="px-1" />
diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.ts
index 025dc975486..472b8f6e3e3 100644
--- a/packages/api-types/types/api.d.ts
+++ b/packages/api-types/types/api.d.ts
@@ -5110,6 +5110,7 @@ export interface components {
is_default: boolean
git_branch?: string
pr_number?: number
+ latest_check_run_id?: number
reset_on_push: boolean
persistent: boolean
/** @enum {string} */