import { useQuery } from '@tanstack/react-query'; import { CheckDisclosure } from '#/components/molecules/check-disclosure.jsx'; import { EmptyState } from '#/components/molecules/empty-state.jsx'; import { checkLook, latestPerWorkflow, loadChecks, summarize, summaryWords, } from '#/lib/checks.js'; import { cn } from '#/lib/utils.js'; /** * What the runner said about the commit this pull request ends on. * * The tip and nothing else, because this is the tab a reader opens to answer * whether the work is ready, and that is a question about the tip. An earlier * commit's runs are not lost: a commit the branch still carries says what its * run said on the conversation and on its own page. What this does drop is a * run against a commit a force-push replaced, which names something that is * not in the branch and cannot be acted on. * * The runs come from the pull request rather than from this account's own * repository: the runner checks the branch on the server that holds it, so * the run names that copy. The runner itself comes from the repository's * config, which is the one thing that says whose runs to read. */ export function PullChecks({ repo, checks, tip, space }) { // Only for the runner, so the log behind a run can be fetched. The query // key is the one the checks page uses, so the two share a read. const { data } = useQuery({ queryKey: ['checks', repo, space ?? ''], queryFn: () => loadChecks(repo, space), }); const runs = latestPerWorkflow(checks.filter((run) => run.sha === tip)); if (runs.length === 0) { return (
{tip.slice(0, 8)}