Skip to content

Commit

Permalink
Merge branch 'main' into feat/shortest-package
Browse files Browse the repository at this point in the history
  • Loading branch information
m2rads committed Oct 30, 2024
2 parents 1c0c322 + 275e5cf commit 9cf9b1f
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions app/(dashboard)/dashboard/pull-request.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useState, useCallback } from "react";
import { useState, useCallback, useEffect } from "react";
import { experimental_useObject as useObject } from "ai/react";
import Link from "next/link";
import dynamic from "next/dynamic";
Expand Down Expand Up @@ -76,8 +76,8 @@ export function PullRequestItem({
},
}
);

const { data: latestRunId } = useSWR(
const { data: latestRunId, error: latestRunIdError } = useSWR(
pullRequest.buildStatus === "success" ||
pullRequest.buildStatus === "failure"
? [
Expand All @@ -87,13 +87,22 @@ export function PullRequestItem({
pullRequest.branchName,
]
: null,
() =>
getLatestRunId(
pullRequest.repository.owner.login,
pullRequest.repository.name,
pullRequest.branchName
)
() => getLatestRunId(
pullRequest.repository.owner.login,
pullRequest.repository.name,
pullRequest.branchName
)
);

useEffect(() => {
if (latestRunId === null && !latestRunIdError) {
toast({
title: `GitHub Actions needed for PR #${initialPullRequest.number}`,
description: `Repository "${initialPullRequest.repository.full_name}" needs GitHub Actions to analyze test failures. Without access to test logs via Actions, we can't help fix failing tests.`,
variant: "destructive",
});
}
}, [latestRunId]);

const { data: logs, error: logsError } = useSWR(
showLogs || latestRunId
Expand Down

0 comments on commit 9cf9b1f

Please sign in to comment.