flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

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

34 lines1,570 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";
6import { assertSameOrigin, getViewer, requireUser, roleIn } from "../../lib/session.server";
7
Social cards for every page: og.g1t.sh8export function meta({ params, ...args }: Route.MetaArgs) {
9 return page(args, { title: `Secrets and variables · ${params.owner}/${params.repo} · g1t` });
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs10}
11
12const ownerOf = (params: { owner: string; repo: string }) => ({ repo: { namespace: params.owner, name: params.repo } });
13
14export async function loader({ params, context, request }: Route.LoaderArgs) {
15 // A repository's settings are its workspace's members' to see.
16 if (!roleIn(getViewer(context), params.owner)) throw new Response(null, { status: 404 });
17 return loadSecrets(ownerOf(params), requireUser(context, request));
18}
19
20export async function action({ request, params, context }: Route.ActionArgs) {
21 assertSameOrigin(request);
22 const user = requireUser(context, request);
Secrets and variables: one list, rows per environment, for workflows and deployments23 const page = `/${params.owner}/${params.repo}/settings/secrets`;
24 return actOnSecrets(ownerOf(params), user, await request.formData(), page);
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs25}
26
27export default function RepoSecrets({ loaderData, actionData, params }: Route.ComponentProps) {
28 return (
29 <div>
Project settings move into the sidebar, grouped, with a heading per page30 <RepoSettingsHeading base={`/${params.owner}/${params.repo}`} />
Projects: what a workspace builds and runs, first on every page31 <SecretsPanel data={loaderData} action={actionData} scope="project" manage />
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs32 </div>
33 );
34}