Skip to content

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.sh
31 linesCodeBlameRaw
1/**
2 * Suspending accounts and workspaces, and blocking email domains: the
3 * forms' rules and words. No Workers imports, so it can be tested under
4 * Node. Identity checks everything again.
5 */
6
7/** The billing hold sudo puts on a suspended workspace, so its compute, deploys, new runners and telemetry stop. */
8export const SUSPENSION_HOLD_PREFIX = "Suspended: ";
9
10export function suspensionHold(reason: string): string {
11 return `${SUSPENSION_HOLD_PREFIX}${reason.trim()}`;
12}
13
14/** Whether a billing hold is one a suspension put there, so lifting the suspension lifts it too. */
15export function isSuspensionHold(hold: string | null | undefined): boolean {
16 return (hold ?? "").startsWith(SUSPENSION_HOLD_PREFIX);
17}
18
19/** The reason a suspension or a block needs: 3 to 500 characters. */
20export function parseReason(raw: string): { ok: true; value: string } | { ok: false; error: string } {
21 const reason = raw.trim().replace(/\s+/g, " ");
22 if (reason.length < 3) return { ok: false, error: "Say why. It is kept with it, and in the audit log." };
23 if (reason.length > 500) return { ok: false, error: "Keep the reason under 500 characters." };
24 return { ok: true, value: reason };
25}
26
27/** What a suspension does, for the forms. */
28export const SUSPEND_ACCOUNT_ABOUT =
29 "A suspended account cannot sign in, with a password or GitHub, and is signed out everywhere at once. Its tokens, SSH keys and git passwords stop working until the suspension is lifted; then they work as before. Nothing is deleted.";
30export const SUSPEND_WORKSPACE_ABOUT =
31 "A suspended workspace's own tokens stop working, and a hold goes on its compute in billing: no new runs, checks, deploys or self-hosted runners, and its telemetry is not taken. Its members can still sign in and read it. Lifting the suspension lifts the hold. Nothing is deleted.";