Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 1 | import { |
| 2 | AlertTriangle, | |
| 3 | Bug, | |
| 4 | Check, | |
| 5 | ChevronDown, | |
| 6 | ChevronRight, | |
| 7 | Cloud, | |
| 8 | Download, | |
| 9 | FileText, | |
| 10 | GitBranch, | |
| 11 | GitCommitHorizontal, | |
| 12 | History, | |
| 13 | Hourglass, | |
| 14 | Info, | |
| 15 | Package, | |
| 16 | Play, | |
| 17 | RotateCw, | |
| 18 | Search, | |
| 19 | ServerCog, | |
| 20 | ShieldAlert, | |
| 21 | Square, | |
| 22 | Trash2, | |
| 23 | Users, | |
| 24 | X, | |
| 25 | XCircle, | |
| 26 | } from "lucide-react"; | |
| 27 | import { type ReactNode, useEffect, useRef, useState } from "react"; | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 28 | import { Form, Link, useLoaderData, useSearchParams } from "react-router"; |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 29 | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 30 | import type { Annotation, EnvironmentReviewer, Job, JobSummary, PendingDeployment, RunApproval, RunAttempt, StepState } from "@g1t/contracts"; |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 31 | |
| 32 | import type { Route } from "./+types/actions-run"; | |
| Social cards for every page: og.g1t.sh | 33 | import { page } from "../../lib/meta"; |
| Merge remote-tracking branch 'origin/main' into workspace-chat | 34 | import { Duration, LogText, Notes, StatusIcon, shortRef, standingWord, useJobLog } from "../../components/actions"; |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 35 | import { Markdown } from "../../components/markdown"; |
| Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002) | 36 | import { DetailsDisclosure } from "../../components/details-disclosure"; |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 37 | import { Button, ErrorText, SubmitButton, TimeAgo, usePending } from "../../components/ui"; |
| 38 | import { CheckboxOption } from "../../components/ui/checkbox"; | |
| 39 | import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../../components/ui/dialog"; | |
| 40 | import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../../components/ui/dropdown-menu"; | |
| Merge branch 'worktree-agent-ae1299e92e4462012' | 41 | import { Hint } from "../../components/ui/hint"; |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 42 | import { searchLog } from "../../lib/log-lines"; |
| Merge branch 'worktree-agent-ab9543c492a7ed481' into spend-guardrails | 43 | import { listArtifacts, withLegacyArtifacts } from "../../lib/artifacts.server"; |
| 44 | import { expiresIn, formatBytes, legacyArtifactsWorthAsking } from "../../lib/artifacts"; | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 45 | import { actions } from "../../lib/services.server"; |
| Runners are owner-only: the page, its actions, the Settings entry and the links to it | 46 | import { assertSameOrigin, getViewer, requireUser, roleIn, unwrap } from "../../lib/session.server"; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 47 | import { accessTo, refusal } from "../../lib/access.server"; |
| A click away from a live page arrives: pages stop refreshing themselves while a navigation is pending | 48 | import { useRefreshWhile } from "../../lib/refresh"; |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 49 | |
| Social cards for every page: og.g1t.sh | 50 | export function meta({ loaderData, params, ...args }: Route.MetaArgs) { |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 51 | const run = loaderData?.detail.run; |
| Social cards for every page: og.g1t.sh | 52 | return page(args, { title: `${run ? `${run.title || run.name} #${run.number}` : "Run"} · ${params.owner}/${params.repo} · g1t` }); |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 53 | } |
| 54 | ||
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 55 | export async function loader({ params, context, request }: Route.LoaderArgs) { |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 56 | const viewer = getViewer(context); |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 57 | const repo = { namespace: params.owner, name: params.repo }; |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 58 | // An earlier attempt, when one is asked for. |
| 59 | const asked = Number(new URL(request.url).searchParams.get("attempt") ?? ""); | |
| 60 | const attempt = Number.isInteger(asked) && asked > 0 ? asked : undefined; | |
| Merge branch 'worktree-agent-ab9543c492a7ed481' into spend-guardrails | 61 | const [detail, kept, summaries] = await Promise.all([ |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 62 | actions.run(repo, viewer, params.id, attempt).then(unwrap), |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 63 | listArtifacts(repo, viewer, params.id).catch(() => []), |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 64 | actions |
| 65 | .summaries(repo, viewer, params.id, attempt) | |
| 66 | .then((found) => (found.ok ? found.value : [])) | |
| 67 | .catch((): JobSummary[] => []), | |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 68 | ]); |
| Merge branch 'worktree-agent-ab9543c492a7ed481' into spend-guardrails | 69 | // Artifacts an older runner kept in KV: asked for only once the service |
| 70 | // has shown the viewer the run, and never while it is still going. | |
| 71 | const artifacts = legacyArtifactsWorthAsking(detail.run) ? await withLegacyArtifacts(kept, params.id) : kept; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 72 | // Cancelling and re-running need Write. |
| Runners are owner-only: the page, its actions, the Settings entry and the links to it | 73 | return { |
| 74 | detail, | |
| 75 | artifacts, | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 76 | summaries, |
| Runners are owner-only: the page, its actions, the Settings entry and the links to it | 77 | member: (await accessTo(context, params)).can.run, |
| 78 | // The runners page is the workspace owners'. | |
| 79 | runnersPage: roleIn(viewer, params.owner) === "owner", | |
| 80 | }; | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 81 | } |
| 82 | ||
| 83 | export async function action({ request, params, context }: Route.ActionArgs) { | |
| 84 | assertSameOrigin(request); | |
| 85 | const user = requireUser(context, request); | |
| 86 | const repo = { namespace: params.owner, name: params.repo }; | |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 87 | const form = await request.formData(); |
| 88 | const intent = String(form.get("intent")); | |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 89 | // Reviewing a deployment is the environment's reviewers' to do: the |
| 90 | // service says who may. | |
| 91 | if (intent === "approve-deployment" || intent === "reject-deployment") { | |
| 92 | const environment = String(form.get("environment") ?? ""); | |
| 93 | const comment = String(form.get("comment") ?? "").trim(); | |
| 94 | const done = await actions.reviewDeployments( | |
| 95 | user, | |
| 96 | repo, | |
| 97 | params.id, | |
| 98 | intent === "approve-deployment" ? "approved" : "rejected", | |
| 99 | environment ? [environment] : [], | |
| 100 | comment || undefined, | |
| 101 | ); | |
| 102 | return done.ok ? {} : { error: done.error.message }; | |
| 103 | } | |
| 104 | // Everything else, approving a run from outside included, needs Write. | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 105 | const refused = await refusal(context, params, "run"); |
| 106 | if (refused) return { error: refused }; | |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 107 | if (intent === "delete-artifact") { |
| 108 | const deleted = await actions.deleteArtifact(user, repo, Number(form.get("artifact"))); | |
| 109 | return deleted.ok ? {} : { error: deleted.error.message }; | |
| 110 | } | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 111 | // Debug logging, for a re-run that asks for it. |
| 112 | const debug = form.get("debug") === "on"; | |
| 113 | const job = String(form.get("job") ?? "") || undefined; | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 114 | const done = |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 115 | intent === "approve-run" |
| 116 | ? await actions.approveRun(user, repo, params.id) | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 117 | : intent === "cancel" || intent === "force-cancel" |
| 118 | ? await actions.cancel(user, repo, params.id, intent === "force-cancel") | |
| 119 | : await actions.rerun(user, repo, params.id, intent === "rerun-failed", { job: intent === "rerun-job" ? job : undefined, debug }); | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 120 | return done.ok ? {} : { error: done.error.message }; |
| 121 | } | |
| 122 | ||
| 123 | const ANNOTATION_ICON: Record<Annotation["level"], ReactNode> = { | |
| 124 | error: <XCircle size={14} className="mt-0.5 shrink-0 text-danger" />, | |
| 125 | warning: <AlertTriangle size={14} className="mt-0.5 shrink-0 text-warn" />, | |
| 126 | notice: <Info size={14} className="mt-0.5 shrink-0 text-muted" />, | |
| 127 | }; | |
| 128 | ||
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 129 | function StepRow({ |
| 130 | step, | |
| 131 | text, | |
| 132 | defaultOpen, | |
| 133 | query = "", | |
| 134 | matches = 0, | |
| 135 | }: { | |
| 136 | step: StepState; | |
| 137 | text: string | undefined; | |
| 138 | defaultOpen: boolean; | |
| 139 | /** A search of the job's log: only its matching lines are shown. */ | |
| 140 | query?: string; | |
| 141 | matches?: number; | |
| 142 | }) { | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 143 | return ( |
| 144 | <details className="group border-t border-line first:border-t-0" open={defaultOpen}> | |
| Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002) | 145 | <summary className="flex min-h-11 cursor-pointer list-none items-center gap-2.5 px-3 py-2 text-sm hover:bg-raised/40 sm:min-h-0 sm:px-4"> |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 146 | <ChevronRight size={14} className="shrink-0 text-faint transition-transform group-open:rotate-90" /> |
| 147 | <StatusIcon status={step.status} conclusion={step.conclusion} size={14} /> | |
| 148 | <span className={`min-w-0 truncate ${step.conclusion === "skipped" ? "text-faint" : ""}`}>{step.name}</span> | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 149 | {query && ( |
| 150 | <span className="shrink-0 rounded-full bg-accent/15 px-1.5 text-xs text-accent"> | |
| 151 | {matches} {matches === 1 ? "line" : "lines"} | |
| 152 | </span> | |
| 153 | )} | |
| Merge remote-tracking branch 'origin/main' into workspace-chat | 154 | <Duration className="ml-auto shrink-0 font-mono text-xs text-faint" start={step.startedAt} end={step.finishedAt} /> |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 155 | </summary> |
| 156 | <div className="border-t border-line bg-bg/60"> | |
| 157 | {text === undefined ? ( | |
| 158 | <p className="px-4 py-2 text-xs text-faint">{step.status === "queued" ? "Not started." : step.conclusion === "skipped" ? "Skipped." : "No output yet."}</p> | |
| 159 | ) : ( | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 160 | <LogText text={text} query={query} /> |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 161 | )} |
| 162 | </div> | |
| 163 | </details> | |
| 164 | ); | |
| 165 | } | |
| 166 | ||
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 167 | /** |
| 168 | * Runs again, after asking whether with debug logging: the whole run, its | |
| 169 | * failed jobs, or one job (with the jobs that need it). | |
| 170 | */ | |
| 171 | function RerunDialog({ | |
| 172 | intent, | |
| 173 | job, | |
| 174 | title, | |
| 175 | description, | |
| 176 | children, | |
| 177 | busy, | |
| 178 | }: { | |
| 179 | intent: "rerun" | "rerun-failed" | "rerun-job"; | |
| 180 | job?: string; | |
| 181 | title: string; | |
| 182 | description: string; | |
| 183 | /** What opens it. */ | |
| 184 | children: (open: () => void) => ReactNode; | |
| 185 | busy: boolean; | |
| 186 | }) { | |
| 187 | const [open, setOpen] = useState(false); | |
| 188 | // Open, saying it is starting, until the new attempt shows or the error does. | |
| 189 | const running = usePending({ intent }); | |
| 190 | const was = useRef(false); | |
| 191 | useEffect(() => { | |
| 192 | if (was.current && !running) setOpen(false); | |
| 193 | was.current = running; | |
| 194 | }, [running]); | |
| 195 | return ( | |
| 196 | <> | |
| 197 | {children(() => setOpen(true))} | |
| 198 | <Dialog open={open} onOpenChange={setOpen}> | |
| 199 | <DialogContent> | |
| 200 | <Form method="post" preventScrollReset className="grid gap-4"> | |
| 201 | <DialogHeader> | |
| 202 | <DialogTitle>{title}</DialogTitle> | |
| 203 | <DialogDescription>{description}</DialogDescription> | |
| 204 | </DialogHeader> | |
| 205 | {job && <input type="hidden" name="job" value={job} />} | |
| 206 | <CheckboxOption | |
| 207 | name="debug" | |
| 208 | label="Enable debug logging" | |
| 209 | description="Sets RUNNER_DEBUG=1 and ACTIONS_STEP_DEBUG: ::debug:: lines are shown, and how each step's if: read." | |
| 210 | /> | |
| 211 | <DialogFooter> | |
| 212 | <Button type="button" variant="quiet" onClick={() => setOpen(false)}> | |
| 213 | Cancel | |
| 214 | </Button> | |
| 215 | <SubmitButton name="intent" value={intent} variant="accent" disabled={busy} pending="Re-running…"> | |
| 216 | <RotateCw size={13} /> | |
| 217 | {title} | |
| 218 | </SubmitButton> | |
| 219 | </DialogFooter> | |
| 220 | </Form> | |
| 221 | </DialogContent> | |
| 222 | </Dialog> | |
| 223 | </> | |
| 224 | ); | |
| 225 | } | |
| 226 | ||
| 227 | /** A link or menu button that sits beside the run's quiet buttons, at their size. */ | |
| 228 | const QUIET_LINK = | |
| 229 | "inline-flex items-center gap-2 rounded-md border border-line px-3.5 py-2 text-sm font-medium text-fg/80 transition-colors hover:border-line-strong hover:bg-surface hover:text-fg"; | |
| 230 | ||
| 231 | /** The run's attempts, newest first, each a link to how it went. */ | |
| 232 | function AttemptPicker({ attempts, shown }: { attempts: RunAttempt[]; shown: number }) { | |
| 233 | const latest = attempts[attempts.length - 1]?.attempt ?? shown; | |
| 234 | return ( | |
| 235 | <DropdownMenu> | |
| 236 | <DropdownMenuTrigger asChild> | |
| 237 | <button type="button" className={QUIET_LINK}> | |
| 238 | <History size={13} /> | |
| 239 | Attempt #{shown} | |
| 240 | <ChevronDown size={13} /> | |
| 241 | </button> | |
| 242 | </DropdownMenuTrigger> | |
| 243 | <DropdownMenuContent align="end" className="min-w-64"> | |
| 244 | {[...attempts].reverse().map((attempt) => ( | |
| 245 | <DropdownMenuItem key={attempt.attempt} asChild> | |
| 246 | <Link | |
| 247 | to={attempt.attempt === latest ? "?" : `?attempt=${attempt.attempt}`} | |
| 248 | preventScrollReset | |
| 249 | className={`flex items-center gap-2 ${attempt.attempt === shown ? "text-fg" : ""}`} | |
| 250 | > | |
| 251 | <StatusIcon status={attempt.status} conclusion={attempt.conclusion} size={14} /> | |
| 252 | <span className="font-medium">Attempt #{attempt.attempt}</span> | |
| 253 | {attempt.debug && <Bug size={12} className="text-faint" aria-label="Debug logging" />} | |
| 254 | <span className="ml-auto truncate text-xs text-faint"> | |
| 255 | {attempt.actor && `${attempt.actor} · `} | |
| 256 | {attempt.startedAt ? <TimeAgo at={attempt.startedAt} /> : "not started"} | |
| 257 | </span> | |
| 258 | </Link> | |
| 259 | </DropdownMenuItem> | |
| 260 | ))} | |
| 261 | </DropdownMenuContent> | |
| 262 | </DropdownMenu> | |
| 263 | ); | |
| 264 | } | |
| 265 | ||
| 266 | /** What the jobs' steps wrote to $GITHUB_STEP_SUMMARY, a card per job. */ | |
| 267 | function Summaries({ summaries, repo }: { summaries: JobSummary[]; repo: { namespace: string; name: string } }) { | |
| 268 | if (summaries.length === 0) return null; | |
| 269 | return ( | |
| 270 | <section aria-label="Job summaries" className="space-y-4"> | |
| 271 | {summaries.map((summary) => ( | |
| 272 | <article key={summary.jobId} className="overflow-hidden rounded-xl border border-line bg-surface"> | |
| 273 | <header className="flex items-center gap-2 border-b border-line px-4 py-2.5 text-sm"> | |
| 274 | <FileText size={14} className="text-muted" /> | |
| 275 | <span className="font-medium">{summary.name}</span> | |
| 276 | <span className="text-faint">summary</span> | |
| 277 | </header> | |
| 278 | <div className="space-y-4 px-5 py-4"> | |
| 279 | {summary.steps.map((step) => ( | |
| 280 | <Markdown key={step.step} source={step.markdown} repo={repo} /> | |
| 281 | ))} | |
| 282 | </div> | |
| 283 | </article> | |
| 284 | ))} | |
| 285 | </section> | |
| 286 | ); | |
| 287 | } | |
| 288 | ||
| New workspaces are told to connect a model, before anything fails | 289 | /** Why a job did not run as asked, with "Integrations" linked where it says so. */ |
| 290 | function Reason({ text, workspace }: { text: string; workspace: string }) { | |
| 291 | const [before, after] = text.split("Integrations"); | |
| 292 | return ( | |
| 293 | <p className="rounded-lg bg-raised px-3 py-2 text-sm text-muted"> | |
| 294 | {after === undefined ? ( | |
| 295 | text | |
| 296 | ) : ( | |
| 297 | <> | |
| 298 | {before} | |
| 299 | <Link to={`/${workspace}/-/integrations`} className="text-accent hover:underline"> | |
| 300 | Integrations | |
| 301 | </Link> | |
| 302 | {after} | |
| 303 | </> | |
| 304 | )} | |
| 305 | </p> | |
| 306 | ); | |
| 307 | } | |
| 308 | ||
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 309 | /** Where the job ran: g1t's own runners, or a self-hosted one by name. */ |
| 310 | function RanOn({ job, workspace }: { job: Job; workspace: string }) { | |
| Runners are owner-only: the page, its actions, the Settings entry and the links to it | 311 | const runnersPage = useLoaderData<typeof loader>().runnersPage; |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 312 | if (job.selfHosted) { |
| Runners are owner-only: the page, its actions, the Settings entry and the links to it | 313 | const badge = "ml-auto inline-flex items-center gap-1.5 rounded-full border border-line px-2.5 py-0.5 text-xs text-muted"; |
| 314 | const label = ( | |
| 315 | <> | |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 316 | <ServerCog size={13} /> |
| 317 | {job.runner ? `Self-hosted: ${job.runner}` : "Self-hosted"} | |
| Runners are owner-only: the page, its actions, the Settings entry and the links to it | 318 | </> |
| 319 | ); | |
| 320 | // A link to the runners for those who manage them, a label for everyone else. | |
| 321 | return runnersPage ? ( | |
| Merge branch 'worktree-agent-ae1299e92e4462012' | 322 | <Hint label="Self-hosted runner"> |
| 323 | <Link to={`/${workspace}/-/runners`} className={`${badge} hover:text-fg`}> | |
| 324 | {label} | |
| 325 | </Link> | |
| 326 | </Hint> | |
| Runners are owner-only: the page, its actions, the Settings entry and the links to it | 327 | ) : ( |
| Merge branch 'worktree-agent-ae1299e92e4462012' | 328 | <Hint label="Self-hosted runner"> |
| 329 | <span className={badge}>{label}</span> | |
| 330 | </Hint> | |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 331 | ); |
| 332 | } | |
| 333 | if (!job.startedAt) return null; | |
| 334 | return ( | |
| 335 | <span className="ml-auto inline-flex items-center gap-1.5 rounded-full border border-line px-2.5 py-0.5 text-xs text-muted"> | |
| 336 | <Cloud size={13} /> | |
| 337 | g1t | |
| 338 | </span> | |
| 339 | ); | |
| 340 | } | |
| 341 | ||
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 342 | function JobView({ job, base, rerun }: { job: Job; base: string; rerun: ReactNode }) { |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 343 | const live = job.status !== "completed"; |
| 344 | const log = useJobLog(`${base}/actions/jobs/${job.id}/log`, live); | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 345 | const [query, setQuery] = useState(""); |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 346 | const failed = job.steps.find((s) => s.conclusion === "failure"); |
| 347 | const running = job.steps.find((s) => s.status === "in_progress"); | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 348 | const searching = query.trim().length > 0; |
| 349 | const setUp: StepState = { | |
| 350 | number: 0, | |
| 351 | name: "Set up job", | |
| 352 | status: job.startedAt ? "completed" : "queued", | |
| 353 | conclusion: job.startedAt ? "success" : null, | |
| 354 | startedAt: job.startedAt, | |
| 355 | finishedAt: job.startedAt, | |
| 356 | }; | |
| 357 | // While searching, the steps with a match, each with how many. | |
| 358 | const steps = [setUp, ...job.steps] | |
| 359 | .map((step) => ({ step, matches: searching ? searchLog(log.get(step.number) ?? "", query).length : 0 })) | |
| 360 | .filter(({ matches }) => !searching || matches > 0); | |
| 361 | const total = steps.reduce((sum, { matches }) => sum + matches, 0); | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 362 | return ( |
| 363 | <section className="min-w-0 space-y-4"> | |
| 364 | <div className="flex flex-wrap items-center gap-3"> | |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 365 | <StatusIcon status={job.status} conclusion={job.conclusion} of="job" environment={job.environment} size={18} /> |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 366 | <h3 className="text-base font-semibold">{job.name}</h3> |
| 367 | <span className="text-sm text-muted"> | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 368 | {job.cancelling ? "Cancelling: running its cleanup steps" : standingWord({ ...job, of: "job" })} |
| Merge remote-tracking branch 'origin/main' into workspace-chat | 369 | {job.startedAt && ( |
| 370 | <> | |
| 371 | {" · "} | |
| 372 | <Duration start={job.startedAt} end={job.finishedAt} /> | |
| 373 | </> | |
| 374 | )} | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 375 | </span> |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 376 | <span className="ml-auto flex items-center gap-2"> |
| 377 | {rerun} | |
| 378 | {job.startedAt && ( | |
| 379 | <Hint label="Download this job's log"> | |
| 380 | <a | |
| 381 | href={`${base}/actions/jobs/${job.id}/log.txt`} | |
| 382 | aria-label={`Download the log of ${job.name}`} | |
| 383 | className="inline-flex items-center rounded-md p-1.5 text-muted ring-1 ring-line hover:text-fg" | |
| 384 | > | |
| 385 | <Download size={13} /> | |
| 386 | </a> | |
| 387 | </Hint> | |
| 388 | )} | |
| 389 | <RanOn job={job} workspace={base.split("/")[1]!} /> | |
| 390 | </span> | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 391 | </div> |
| New workspaces are told to connect a model, before anything fails | 392 | {job.reason && <Reason text={job.reason} workspace={base.split("/")[1]} />} |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 393 | {job.annotations.length > 0 && ( |
| 394 | <ul className="space-y-2 rounded-xl border border-line bg-surface p-4 text-sm"> | |
| 395 | {job.annotations.map((note, index) => ( | |
| 396 | <li key={index} className="flex gap-2"> | |
| 397 | {ANNOTATION_ICON[note.level]} | |
| 398 | <span className="min-w-0"> | |
| 399 | {note.title && <span className="font-medium">{note.title}: </span>} | |
| Phones reach every page: each mode's menu from the top bar or by tapping the tab you're on, Docs first in the avatar sheet, a project's pages as a swipeable strip; dialogs as bottom sheets above the keyboard, safe areas, menus kept on screen, 40px targets, touch-visible controls, save bars above the tab bar | 400 | <span className="whitespace-pre-wrap wrap-break-word">{note.message}</span> |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 401 | {note.file && ( |
| 402 | <span className="block font-mono text-xs text-faint"> | |
| 403 | {note.file} | |
| 404 | {note.line != null && `:${note.line}`} | |
| 405 | </span> | |
| 406 | )} | |
| 407 | </span> | |
| 408 | </li> | |
| 409 | ))} | |
| 410 | </ul> | |
| 411 | )} | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 412 | {job.startedAt && ( |
| 413 | <label className="flex items-center gap-2 rounded-lg border border-line bg-surface px-3 py-1.5 text-sm focus-within:border-accent-dim"> | |
| 414 | <Search size={14} className="shrink-0 text-faint" /> | |
| 415 | <input | |
| 416 | type="search" | |
| 417 | value={query} | |
| 418 | onChange={(event) => setQuery(event.target.value)} | |
| 419 | placeholder="Search logs" | |
| 420 | aria-label={`Search the log of ${job.name}`} | |
| 421 | className="min-w-0 grow bg-transparent outline-none placeholder:text-faint" | |
| 422 | /> | |
| 423 | {searching && ( | |
| 424 | <span className="shrink-0 text-xs text-muted" aria-live="polite"> | |
| 425 | {total} {total === 1 ? "line" : "lines"} | |
| 426 | </span> | |
| 427 | )} | |
| 428 | </label> | |
| 429 | )} | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 430 | <div className="overflow-hidden rounded-xl border border-line bg-surface"> |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 431 | {searching && steps.length === 0 && <p className="px-4 py-3 text-sm text-muted">No line of this job's log holds “{query.trim()}”.</p>} |
| 432 | {steps.map(({ step, matches }) => ( | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 433 | <StepRow |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 434 | // Searching opens every step with a match; clearing it puts them back. |
| 435 | key={`${step.number}:${searching}`} | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 436 | step={step} |
| 437 | text={log.get(step.number)} | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 438 | defaultOpen={searching || (step.number !== 0 && step.number === (failed ?? running)?.number)} |
| 439 | query={searching ? query : ""} | |
| 440 | matches={matches} | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 441 | /> |
| 442 | ))} | |
| 443 | </div> | |
| 444 | </section> | |
| 445 | ); | |
| 446 | } | |
| 447 | ||
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 448 | /** A run held by its environments, in words that say what for: a review, or only a wait timer. */ |
| 449 | function runWord(status: string, deployments: PendingDeployment[]): string | null { | |
| 450 | if (status !== "waiting") return null; | |
| 451 | const waiting = deployments.filter((deployment) => deployment.state === "waiting"); | |
| 452 | return waiting.length > 0 && waiting.every((deployment) => !deployment.needsReview) ? "Waiting for a wait timer" : null; | |
| 453 | } | |
| 454 | ||
| 455 | /** Whether a wait timer has yet to run out. */ | |
| 456 | function timerRunning(deployment: PendingDeployment): boolean { | |
| 457 | return Boolean(deployment.waitUntil && new Date(deployment.waitUntil).getTime() > Date.now()); | |
| 458 | } | |
| 459 | ||
| 460 | /** Whether environments still hold some of the run's jobs. */ | |
| 461 | function held(deployments: PendingDeployment[]): boolean { | |
| 462 | return deployments.some( | |
| 463 | (deployment) => deployment.state === "waiting" || (deployment.state === "approved" && timerRunning(deployment)), | |
| 464 | ); | |
| 465 | } | |
| 466 | ||
| 467 | /** `in 12m`, `in 2h 5m`: how long until a time. */ | |
| 468 | function untilWords(at: string): string { | |
| 469 | const minutes = Math.max(1, Math.ceil((new Date(at).getTime() - Date.now()) / 60_000)); | |
| 470 | if (minutes < 60) return `in ${minutes}m`; | |
| 471 | const hours = Math.floor(minutes / 60); | |
| 472 | if (hours < 48) return `in ${hours}h${minutes % 60 ? ` ${minutes % 60}m` : ""}`; | |
| 473 | return `in ${Math.round(hours / 24)}d`; | |
| 474 | } | |
| 475 | ||
| 476 | /** A user by name, a team as @team. */ | |
| 477 | function ReviewerChip({ reviewer }: { reviewer: EnvironmentReviewer }) { | |
| 478 | return ( | |
| 479 | <span className="inline-flex items-center gap-1 rounded-md bg-raised px-1.5 py-0.5 font-mono text-xs text-fg/85"> | |
| 480 | {reviewer.type === "team" && <Users size={11} className="text-muted" />} | |
| 481 | {reviewer.type === "team" ? `@${reviewer.name}` : reviewer.name} | |
| 482 | </span> | |
| 483 | ); | |
| 484 | } | |
| 485 | ||
| 486 | /** A pull request's run from outside, waiting for someone with Write to let it start. */ | |
| 487 | function ApprovalPanel({ approval, member, busy }: { approval: RunApproval; member: boolean; busy: boolean }) { | |
| 488 | return ( | |
| 489 | <section className="flex flex-col gap-4 rounded-xl border border-warn/30 bg-warn/5 p-4 sm:flex-row sm:items-start"> | |
| 490 | <ShieldAlert size={18} className="mt-0.5 hidden shrink-0 text-warn sm:block" /> | |
| 491 | <div className="min-w-0 grow space-y-1.5 text-sm"> | |
| 492 | <h3 className="flex items-center gap-2 font-medium"> | |
| 493 | <ShieldAlert size={16} className="shrink-0 text-warn sm:hidden" /> | |
| 494 | Approval required | |
| 495 | </h3> | |
| 496 | <p className="text-fg/85">{approval.reason}</p> | |
| 497 | <p className="text-muted"> | |
| 498 | Nothing in this run starts, and it gets no secrets and no token, until someone with the Write role approves it. | |
| 499 | {!member && " Ask someone with the Write role on this repository to approve it."} | |
| 500 | </p> | |
| 501 | </div> | |
| 502 | {member && ( | |
| 503 | <Form method="post" className="shrink-0"> | |
| 504 | <SubmitButton name="intent" value="approve-run" variant="accent" disabled={busy} pending="Approving…"> | |
| 505 | <Play size={13} /> | |
| 506 | Approve and run | |
| 507 | </SubmitButton> | |
| 508 | </Form> | |
| 509 | )} | |
| 510 | </section> | |
| 511 | ); | |
| 512 | } | |
| 513 | ||
| 514 | const DEPLOYMENT_ICON: Record<PendingDeployment["state"], ReactNode> = { | |
| 515 | waiting: <Hourglass size={15} className="shrink-0 text-warn" />, | |
| 516 | approved: ( | |
| 517 | <span className="inline-flex shrink-0 rounded-full bg-success/15 p-0.5 text-success"> | |
| 518 | <Check size={11} strokeWidth={3} /> | |
| 519 | </span> | |
| 520 | ), | |
| 521 | rejected: ( | |
| 522 | <span className="inline-flex shrink-0 rounded-full bg-danger/15 p-0.5 text-danger"> | |
| 523 | <X size={11} strokeWidth={3} /> | |
| 524 | </span> | |
| 525 | ), | |
| 526 | }; | |
| 527 | ||
| 528 | /** Where one environment's rules stand for this run, and a way to review it for those who may. */ | |
| 529 | function DeploymentRow({ deployment, busy }: { deployment: PendingDeployment; busy: boolean }) { | |
| 530 | const waiting = deployment.state === "waiting"; | |
| 531 | const timer = timerRunning(deployment); | |
| 532 | const words = | |
| 533 | deployment.state === "approved" | |
| 534 | ? timer | |
| 535 | ? "Approved · waiting for its wait timer" | |
| 536 | : "Approved" | |
| 537 | : deployment.state === "rejected" | |
| 538 | ? "Rejected" | |
| 539 | : deployment.needsReview | |
| 540 | ? "Waiting for review" | |
| 541 | : "Waiting for its wait timer"; | |
| 542 | return ( | |
| 543 | <li className="space-y-3 px-4 py-4"> | |
| 544 | <div className="flex flex-wrap items-center gap-x-2.5 gap-y-1"> | |
| 545 | {DEPLOYMENT_ICON[deployment.state]} | |
| 546 | <span className="font-mono text-sm font-medium">{deployment.environment}</span> | |
| 547 | <span className="text-sm text-muted">{words}</span> | |
| 548 | </div> | |
| 549 | <dl className="grid gap-x-4 gap-y-1.5 text-sm sm:grid-cols-[7rem_1fr]"> | |
| 550 | {deployment.jobs.length > 0 && ( | |
| 551 | <> | |
| 552 | <dt className="text-muted">{deployment.jobs.length === 1 ? "Job" : "Jobs"}</dt> | |
| 553 | <dd className="flex min-w-0 flex-wrap gap-1.5"> | |
| 554 | {deployment.jobs.map((job) => ( | |
| 555 | <span key={job} className="rounded-md bg-raised px-1.5 py-0.5 text-xs"> | |
| 556 | {job} | |
| 557 | </span> | |
| 558 | ))} | |
| 559 | </dd> | |
| 560 | </> | |
| 561 | )} | |
| 562 | {deployment.reviewers.length > 0 && ( | |
| 563 | <> | |
| 564 | <dt className="text-muted">Reviewers</dt> | |
| 565 | <dd className="flex min-w-0 flex-wrap gap-1.5"> | |
| 566 | {deployment.reviewers.map((reviewer) => ( | |
| 567 | <ReviewerChip key={`${reviewer.type}:${reviewer.name}`} reviewer={reviewer} /> | |
| 568 | ))} | |
| 569 | </dd> | |
| 570 | </> | |
| 571 | )} | |
| 572 | {deployment.waitUntil && (waiting || timer) && ( | |
| 573 | <> | |
| 574 | <dt className="text-muted">Wait timer</dt> | |
| 575 | <dd> | |
| 576 | {timer ? ( | |
| 577 | <> | |
| 578 | Starts at{" "} | |
| 579 | <time dateTime={deployment.waitUntil} suppressHydrationWarning> | |
| 580 | {new Date(deployment.waitUntil).toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" })} | |
| 581 | </time>{" "} | |
| 582 | <span className="text-muted" suppressHydrationWarning> | |
| 583 | ({untilWords(deployment.waitUntil)}) | |
| 584 | </span> | |
| 585 | </> | |
| 586 | ) : ( | |
| 587 | "Done" | |
| 588 | )} | |
| 589 | </dd> | |
| 590 | </> | |
| 591 | )} | |
| 592 | {deployment.reviewedBy && ( | |
| 593 | <> | |
| 594 | <dt className="text-muted">{deployment.state === "rejected" ? "Rejected by" : "Approved by"}</dt> | |
| 595 | <dd className="min-w-0"> | |
| 596 | <span className="font-mono text-xs">{deployment.reviewedBy}</span> | |
| 597 | {deployment.reviewedAt && ( | |
| 598 | <span className="text-muted"> | |
| 599 | {" "} | |
| 600 | · <TimeAgo at={deployment.reviewedAt} /> | |
| 601 | </span> | |
| 602 | )} | |
| 603 | {deployment.comment && <p className="mt-1 whitespace-pre-wrap break-words text-fg/85">{deployment.comment}</p>} | |
| 604 | </dd> | |
| 605 | </> | |
| 606 | )} | |
| 607 | </dl> | |
| 608 | {waiting && deployment.needsReview && deployment.canReview && ( | |
| 609 | <Form method="post" className="space-y-3"> | |
| 610 | <input type="hidden" name="environment" value={deployment.environment} /> | |
| 611 | <label className="block"> | |
| 612 | <span className="mb-1.5 block text-xs font-medium text-muted">Comment (optional)</span> | |
| 613 | <textarea | |
| 614 | name="comment" | |
| 615 | rows={2} | |
| 616 | maxLength={1000} | |
| 617 | placeholder="Why you approve or reject it" | |
| 618 | className="w-full rounded-md border border-line bg-bg px-3 py-2 text-sm outline-none transition-colors placeholder:text-faint hover:border-line-strong focus:border-accent-dim" | |
| 619 | /> | |
| 620 | </label> | |
| 621 | <div className="flex flex-wrap gap-2"> | |
| 622 | <SubmitButton name="intent" value="approve-deployment" variant="accent" disabled={busy} pending="Approving…"> | |
| 623 | <Check size={13} /> | |
| 624 | Approve and deploy | |
| 625 | </SubmitButton> | |
| 626 | <SubmitButton name="intent" value="reject-deployment" variant="danger" disabled={busy} pending="Rejecting…"> | |
| 627 | <X size={13} /> | |
| 628 | Reject | |
| 629 | </SubmitButton> | |
| 630 | </div> | |
| 631 | </Form> | |
| 632 | )} | |
| 633 | {waiting && deployment.needsReview && !deployment.canReview && ( | |
| 634 | <p className="text-sm text-muted"> | |
| 635 | {deployment.reviewers.length > 0 | |
| 636 | ? "Only its reviewers can approve or reject it." | |
| 637 | : "Only someone this environment's rules name can approve or reject it."} | |
| 638 | </p> | |
| 639 | )} | |
| 640 | </li> | |
| 641 | ); | |
| 642 | } | |
| 643 | ||
| 644 | /** The environments holding the run's jobs, each with where its rules stand. */ | |
| 645 | function DeploymentsPanel({ deployments, busy }: { deployments: PendingDeployment[]; busy: boolean }) { | |
| 646 | const review = deployments.some((deployment) => deployment.state === "waiting" && deployment.needsReview); | |
| 647 | return ( | |
| 648 | <section className="overflow-hidden rounded-xl border border-line bg-surface"> | |
| 649 | <header className="flex items-start gap-2.5 border-b border-line px-4 py-3"> | |
| 650 | <Hourglass size={16} className="mt-0.5 shrink-0 text-warn" /> | |
| 651 | <div className="min-w-0"> | |
| 652 | <h3 className="text-sm font-medium">{review ? "Waiting for review" : "Waiting to deploy"}</h3> | |
| 653 | <p className="mt-0.5 text-sm text-muted"> | |
| 654 | Jobs that deploy to these environments wait until each environment's protection rules let them through, and | |
| 655 | only then get its secrets. | |
| 656 | </p> | |
| 657 | </div> | |
| 658 | </header> | |
| 659 | <ul className="divide-y divide-line"> | |
| 660 | {deployments.map((deployment) => ( | |
| 661 | <DeploymentRow key={deployment.environment} deployment={deployment} busy={busy} /> | |
| 662 | ))} | |
| 663 | </ul> | |
| 664 | </section> | |
| 665 | ); | |
| 666 | } | |
| 667 | ||
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 668 | export default function ActionsRun({ loaderData, actionData, params }: Route.ComponentProps) { |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 669 | const { detail, artifacts, member, summaries } = loaderData; |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 670 | const { run, jobs, notes } = detail; |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 671 | const deployments = detail.pendingDeployments ?? []; |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 672 | const attempts = detail.attempts ?? []; |
| 673 | const latest = attempts.length === 0 || run.attempt === attempts[attempts.length - 1]!.attempt; | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 674 | const base = `/${params.owner}/${params.repo}`; |
| 675 | const [search] = useSearchParams(); | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 676 | // One of the run's buttons is working: the others wait for it. |
| 677 | const busy = usePending(); | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 678 | const live = run.status !== "completed"; |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 679 | // Cancelled, while its jobs run their cleanup steps. |
| 680 | const cancelling = live && run.conclusion === "cancelled"; | |
| 681 | // Re-running is for the latest attempt of a finished run. | |
| 682 | const canRerun = member && !run.error && !live && latest; | |
| 683 | const logsUrl = `${base}/actions/runs/${run.id}/logs.zip${latest ? "" : `?attempt=${run.attempt}`}`; | |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 684 | // Waiting on a person needs no quick refresh; a running job does. |
| 685 | useRefreshWhile(live, run.status === "action_required" || run.status === "waiting" ? 8000 : 2500); | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 686 | |
| 687 | // The job asked for, else one that failed, is running, or the first. | |
| 688 | const selected = | |
| 689 | jobs.find((job) => job.id === search.get("job")) ?? | |
| 690 | jobs.find((job) => job.conclusion === "failure" && job.steps.length > 0) ?? | |
| 691 | jobs.find((job) => job.status === "in_progress") ?? | |
| 692 | jobs[0]; | |
| 693 | const anyFailed = jobs.some((job) => job.conclusion === "failure" || job.conclusion === "cancelled"); | |
| 694 | ||
| 695 | return ( | |
| 696 | <div className="max-w-6xl space-y-6"> | |
| 697 | <header className="space-y-3"> | |
| 698 | <Link to={`${base}/actions?workflow=${run.workflowId}`} className="text-sm text-muted hover:text-fg"> | |
| 699 | {run.name} | |
| 700 | </Link> | |
| 701 | <div className="flex flex-wrap items-start justify-between gap-4"> | |
| Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002) | 702 | <h2 className="flex min-w-0 items-start gap-2.5 text-xl font-semibold tracking-tight sm:items-center"> |
| 703 | <span className="mt-1 shrink-0 sm:mt-0"> | |
| 704 | <StatusIcon status={run.status} conclusion={run.conclusion} size={20} /> | |
| 705 | </span> | |
| 706 | <span className="min-w-0 wrap-break-word sm:truncate">{run.title || run.name}</span> | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 707 | <span className="font-normal text-muted">#{run.number}</span> |
| 708 | </h2> | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 709 | <div className="flex flex-wrap items-center gap-2"> |
| 710 | {attempts.length > 1 && <AttemptPicker attempts={attempts} shown={run.attempt} />} | |
| 711 | {jobs.some((job) => job.startedAt) && ( | |
| 712 | <Hint label={latest ? "Every job's log, as a zip" : `Attempt #${run.attempt}'s logs, as a zip`}> | |
| 713 | <a href={logsUrl} className={QUIET_LINK}> | |
| 714 | <Download size={13} /> | |
| 715 | Download logs | |
| 716 | </a> | |
| 717 | </Hint> | |
| 718 | )} | |
| 719 | {member && !run.error && live && ( | |
| 720 | <Form method="post" className="flex gap-2"> | |
| 721 | {cancelling ? ( | |
| 722 | <Hint label="Stop its jobs now, without waiting for their cleanup steps"> | |
| 723 | <SubmitButton name="intent" value="force-cancel" variant="danger" disabled={busy} pending="Stopping…"> | |
| 724 | <Square size={13} /> | |
| 725 | Force cancel | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 726 | </SubmitButton> |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 727 | </Hint> |
| 728 | ) : ( | |
| 729 | <SubmitButton name="intent" value="cancel" variant="quiet" disabled={busy} pending="Cancelling…"> | |
| 730 | <Square size={13} /> | |
| 731 | Cancel run | |
| 732 | </SubmitButton> | |
| 733 | )} | |
| 734 | </Form> | |
| 735 | )} | |
| 736 | {canRerun && anyFailed && ( | |
| 737 | <RerunDialog | |
| 738 | intent="rerun-failed" | |
| 739 | title="Re-run failed jobs" | |
| 740 | description="The jobs that did not succeed run again as a new attempt, with every job that needs them. The others keep how they ended." | |
| 741 | busy={busy} | |
| 742 | > | |
| 743 | {(open) => ( | |
| 744 | <Button type="button" variant="quiet" disabled={busy} onClick={open}> | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 745 | <RotateCw size={13} /> |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 746 | Re-run failed jobs |
| 747 | </Button> | |
| 748 | )} | |
| 749 | </RerunDialog> | |
| 750 | )} | |
| 751 | {canRerun && ( | |
| 752 | <RerunDialog | |
| 753 | intent="rerun" | |
| 754 | title="Re-run all jobs" | |
| 755 | description="Every job runs again as a new attempt. This attempt stays here, with its logs." | |
| 756 | busy={busy} | |
| 757 | > | |
| 758 | {(open) => ( | |
| 759 | <Button type="button" variant="quiet" disabled={busy} onClick={open}> | |
| 760 | <RotateCw size={13} /> | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 761 | Re-run all jobs |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 762 | </Button> |
| 763 | )} | |
| 764 | </RerunDialog> | |
| 765 | )} | |
| 766 | </div> | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 767 | </div> |
| 768 | <p className="flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted"> | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 769 | <span>{runWord(run.status, deployments) ?? (cancelling ? "Cancelling" : standingWord(run))}</span> |
| Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002) | 770 | {/* A pull request's ref is its number, which the link beside it already shows. */} |
| 771 | {!(run.pull != null && /^refs\/pull\//.test(run.ref)) && ( | |
| 772 | <span className="inline-flex items-center gap-1 font-mono text-xs"> | |
| 773 | <GitBranch size={12} /> | |
| 774 | {shortRef(run.ref)} | |
| 775 | </span> | |
| 776 | )} | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 777 | <Link to={`${base}/commit/${run.sha}`} className="inline-flex items-center gap-1 font-mono text-xs hover:text-fg"> |
| 778 | <GitCommitHorizontal size={12} /> | |
| 779 | {run.sha.slice(0, 7)} | |
| 780 | </Link> | |
| 781 | {run.pull != null && ( | |
| 782 | <Link to={`${base}/pull/${run.pull}`} className="hover:text-fg"> | |
| 783 | #{run.pull} | |
| 784 | </Link> | |
| 785 | )} | |
| 786 | <span> | |
| 787 | {run.event} | |
| 788 | {run.actor && ` by ${run.actor}`} · <TimeAgo at={run.createdAt} /> | |
| 789 | </span> | |
| Merge remote-tracking branch 'origin/main' into workspace-chat | 790 | {run.startedAt && <Duration className="font-mono text-xs" start={run.startedAt} end={run.finishedAt} />} |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 791 | {run.attempt > 1 && attempts.length <= 1 && <span>Attempt {run.attempt}</span>} |
| 792 | {cancelling && <span className="text-warn">Its jobs are running their cleanup steps</span>} | |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 793 | {detail.approval?.state === "approved" && detail.approval.approvedBy && <span>Approved by {detail.approval.approvedBy}</span>} |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 794 | </p> |
| 795 | </header> | |
| 796 | ||
| 797 | <ErrorText>{actionData && "error" in actionData ? actionData.error : null}</ErrorText> | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 798 | {!latest && ( |
| 799 | <p className="flex flex-wrap items-center gap-x-2 gap-y-1 rounded-xl border border-line bg-surface px-4 py-3 text-sm text-muted"> | |
| 800 | <History size={15} className="shrink-0" /> | |
| 801 | <span> | |
| 802 | This is attempt #{run.attempt} of {attempts.length}, as it ended. | |
| 803 | </span> | |
| 804 | <Link to="?" className="text-accent hover:underline"> | |
| 805 | See the latest attempt | |
| 806 | </Link> | |
| 807 | </p> | |
| 808 | )} | |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 809 | {detail.approval?.state === "required" && <ApprovalPanel approval={detail.approval} member={member} busy={busy} />} |
| 810 | {live && held(deployments) && <DeploymentsPanel deployments={deployments} busy={busy} />} | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 811 | {run.error && ( |
| 812 | <div className="rounded-xl border border-danger/30 bg-danger/5 p-4 text-sm"> | |
| 813 | <p className="font-medium text-danger">The workflow file could not be used</p> | |
| Phones reach every page: each mode's menu from the top bar or by tapping the tab you're on, Docs first in the avatar sheet, a project's pages as a swipeable strip; dialogs as bottom sheets above the keyboard, safe areas, menus kept on screen, 40px targets, touch-visible controls, save bars above the tab bar | 814 | <p className="mt-1 whitespace-pre-wrap wrap-break-word text-fg/85">{run.error}</p> |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 815 | </div> |
| 816 | )} | |
| 817 | <Notes notes={notes} /> | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 818 | <Summaries summaries={summaries} repo={{ namespace: params.owner, name: params.repo }} /> |
| Actions: workflow_run, workflow.completed, artifacts on the run page, Node 24 | 819 | {artifacts.length > 0 && ( |
| 820 | <section className="rounded-xl border border-line bg-surface p-4"> | |
| 821 | <h3 className="flex items-center gap-2 text-sm font-medium"> | |
| 822 | <Package size={14} className="text-muted" /> | |
| 823 | Artifacts | |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 824 | <span className="font-normal text-faint"> |
| 825 | · {artifacts.length} · {formatBytes(artifacts.reduce((sum, a) => sum + a.size, 0))} | |
| 826 | </span> | |
| Actions: workflow_run, workflow.completed, artifacts on the run page, Node 24 | 827 | </h3> |
| 828 | <ul className="mt-3 divide-y divide-line text-sm"> | |
| 829 | {artifacts.map((artifact) => ( | |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 830 | <li key={artifact.name} className="flex flex-wrap items-center gap-x-3 gap-y-1 py-2"> |
| 831 | <span className="min-w-0 grow basis-full truncate font-mono text-[0.8125rem] sm:basis-40">{artifact.name}</span> | |
| 832 | <span className="flex shrink-0 items-center gap-3 text-xs text-faint"> | |
| 833 | <span>{formatBytes(artifact.size)}</span> | |
| 834 | {artifact.expiresAt && <span>{expiresIn(artifact.expiresAt)}</span>} | |
| 835 | </span> | |
| 836 | <span className="ml-auto flex shrink-0 items-center gap-1.5"> | |
| 837 | <a | |
| 838 | href={`${base}/actions/runs/${run.id}/artifacts/${encodeURIComponent(artifact.name)}`} | |
| 839 | className="inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted ring-1 ring-line hover:text-fg" | |
| 840 | > | |
| 841 | <Download size={12} /> | |
| 842 | Download | |
| 843 | </a> | |
| 844 | {member && artifact.id != null && ( | |
| 845 | <Form method="post" preventScrollReset> | |
| 846 | <input type="hidden" name="artifact" value={artifact.id} /> | |
| 847 | <Hint label={`Delete ${artifact.name} now`}> | |
| 848 | <SubmitButton | |
| 849 | name="intent" | |
| 850 | value="delete-artifact" | |
| 851 | icon | |
| 852 | disabled={busy} | |
| 853 | aria-label={`Delete ${artifact.name}`} | |
| 854 | className="inline-flex items-center rounded-md p-1.5 text-muted ring-1 ring-line hover:text-danger disabled:opacity-50" | |
| 855 | > | |
| 856 | <Trash2 size={12} /> | |
| 857 | </SubmitButton> | |
| 858 | </Hint> | |
| 859 | </Form> | |
| 860 | )} | |
| 861 | </span> | |
| Actions: workflow_run, workflow.completed, artifacts on the run page, Node 24 | 862 | </li> |
| 863 | ))} | |
| 864 | </ul> | |
| 865 | </section> | |
| 866 | )} | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 867 | |
| 868 | {jobs.length > 0 && ( | |
| 869 | <div className="grid gap-6 lg:grid-cols-[15rem_1fr]"> | |
| Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002) | 870 | <DetailsDisclosure |
| 871 | label="Jobs" | |
| 872 | summary={selected ? `${jobs.length} · ${selected.name}` : String(jobs.length)} | |
| 873 | bodyClassName="space-y-0.5" | |
| 874 | > | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 875 | <nav aria-label="Jobs" className="space-y-0.5 text-sm"> |
| 876 | {jobs.map((job) => ( | |
| 877 | <Link | |
| 878 | key={job.id} | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 879 | to={latest ? `?job=${job.id}` : `?attempt=${run.attempt}&job=${job.id}`} |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 880 | preventScrollReset |
| Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002) | 881 | className={`flex min-h-11 items-center gap-2 rounded-md px-2.5 py-1.5 sm:min-h-0 ${ |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 882 | job.id === selected?.id ? "bg-raised text-fg" : "text-muted hover:bg-raised/60 hover:text-fg" |
| 883 | }`} | |
| 884 | > | |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 885 | <StatusIcon status={job.status} conclusion={job.conclusion} of="job" environment={job.environment} size={14} /> |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 886 | <span className="min-w-0 truncate">{job.name}</span> |
| Merge remote-tracking branch 'origin/main' into workspace-chat | 887 | <Duration className="ml-auto shrink-0 font-mono text-xs text-faint" start={job.startedAt} end={job.finishedAt} /> |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 888 | </Link> |
| 889 | ))} | |
| 890 | </nav> | |
| Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002) | 891 | </DetailsDisclosure> |
| Merge branch 'worktree-agent-a985c01f43538af01' | 892 | {/* Run again, a job keeps its id but its log starts afresh. */} |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 893 | {selected && ( |
| 894 | <JobView | |
| 895 | key={`${selected.id}:${run.attempt}`} | |
| 896 | job={selected} | |
| 897 | base={base} | |
| 898 | rerun={ | |
| 899 | canRerun && selected.status === "completed" ? ( | |
| 900 | <RerunDialog | |
| 901 | intent="rerun-job" | |
| 902 | job={selected.id} | |
| 903 | title="Re-run this job" | |
| 904 | description={`${selected.name} runs again as a new attempt, with every job that needs it. A job of a matrix runs again with the rest of its matrix.`} | |
| 905 | busy={busy} | |
| 906 | > | |
| 907 | {(open) => ( | |
| 908 | <Hint label="Re-run this job"> | |
| 909 | <button | |
| 910 | type="button" | |
| 911 | aria-label={`Re-run ${selected.name}`} | |
| 912 | disabled={busy} | |
| 913 | onClick={open} | |
| 914 | className="inline-flex items-center rounded-md p-1.5 text-muted ring-1 ring-line hover:text-fg disabled:opacity-50" | |
| 915 | > | |
| 916 | <RotateCw size={13} /> | |
| 917 | </button> | |
| 918 | </Hint> | |
| 919 | )} | |
| 920 | </RerunDialog> | |
| 921 | ) : null | |
| 922 | } | |
| 923 | /> | |
| 924 | )} | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 925 | </div> |
| 926 | )} | |
| 927 | </div> | |
| 928 | ); | |
| 929 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.