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.
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 1 | /** |
| 2 | * A repository's branch names as JSON, for choosing one without loading | |
| 3 | * them with the page: a pull request's base, when someone changes it. | |
| 4 | */ | |
| 5 | import { data } from "react-router"; | |
| 6 | ||
| 7 | import type { Route } from "./+types/branch-names"; | |
| 8 | import { repos } from "../../lib/services.server"; | |
| 9 | import { getViewer } from "../../lib/session.server"; | |
| 10 | ||
| 11 | export async function loader({ params, context }: Route.LoaderArgs) { | |
| 12 | const found = await repos.branches({ namespace: params.owner, name: params.repo }, getViewer(context)); | |
| 13 | if (!found.ok) throw data({ error: found.error.message }, { status: 404 }); | |
| 14 | return Response.json( | |
| 15 | { | |
| 16 | // The merge queue's own branches are g1t's, never a base. | |
| 17 | branches: found.value.map((branch) => branch.name).filter((name) => !name.startsWith("g1t-queue/")), | |
| 18 | }, | |
| 19 | { headers: { "cache-control": "no-store" } }, | |
| 20 | ); | |
| 21 | } |