g1t/apps/web/app/routes/repo/secrets.tsx

36 lines1,669 bytesCodeBlame

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.

GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs1import type { Route } from "./+types/secrets";
Social cards for every page: og.g1t.sh2import { page } from "../../lib/meta";
Project settings move into the sidebar, grouped, with a heading per page3import { RepoSettingsHeading } from "../../components/repo-settings-heading";
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs4import { SecretsPanel } from "../../components/secrets";
5import { actOnSecrets, loadSecrets } from "../../lib/secrets.server";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look6import { assertSameOrigin, requireUser } from "../../lib/session.server";
7import { requireCapability, requireInsider } from "../../lib/access.server";
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs8
Social cards for every page: og.g1t.sh9export function meta({ params, ...args }: Route.MetaArgs) {
10 return page(args, { title: `Secrets and variables · ${params.owner}/${params.repo} · g1t` });
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs11}
12
13const ownerOf = (params: { owner: string; repo: string }) => ({ repo: { namespace: params.owner, name: params.repo } });
14
15export async function loader({ params, context, request }: Route.LoaderArgs) {
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look16 // Admins; to anyone without a role here the page does not exist.
17 await requireInsider(context, params, "manage_integrations");
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs18 return loadSecrets(ownerOf(params), requireUser(context, request));
19}
20
21export async function action({ request, params, context }: Route.ActionArgs) {
22 assertSameOrigin(request);
23 const user = requireUser(context, request);
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look24 await requireCapability(context, params, "manage_integrations");
Secrets and variables: one list, rows per environment, for workflows and deployments25 const page = `/${params.owner}/${params.repo}/settings/secrets`;
26 return actOnSecrets(ownerOf(params), user, await request.formData(), page);
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs27}
28
29export default function RepoSecrets({ loaderData, actionData, params }: Route.ComponentProps) {
30 return (
31 <div>
Project settings move into the sidebar, grouped, with a heading per page32 <RepoSettingsHeading base={`/${params.owner}/${params.repo}`} />
Projects: what a workspace builds and runs, first on every page33 <SecretsPanel data={loaderData} action={actionData} scope="project" manage />
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs34 </div>
35 );
36}