pr_01m47d15m3e54sn21z27rpy5n9/apps/web/app/lib/github.server.ts
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.
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 1 | import { env } from "cloudflare:workers"; |
| 2 | ||
| 3 | import { githubAppClient, githubSignInClient } from "@g1t/contracts"; | |
| 4 | ||
| 5 | /** Signing in with GitHub, kept by the identity service. */ | |
| 6 | export const githubSignIn = githubSignInClient(env.IDENTITY); | |
| 7 | /** g1t's GitHub App: installations, imports and mirrors, kept by integrations. */ | |
| 8 | export const githubApp = githubAppClient(env.INTEGRATIONS); | |
| 9 | ||
| 10 | /** | |
| 11 | * Whether this g1t offers signing in with GitHub. False when no app is | |
| 12 | * configured, or identity cannot say: the button is then left out. | |
| 13 | */ | |
| 14 | export async function githubSignInEnabled(): Promise<boolean> { | |
| 15 | return githubSignIn.enabled().catch(() => false); | |
| 16 | } | |
| 17 | ||
| 18 | /** Where GitHub returns after sign-in: registered on the app, exactly. */ | |
| 19 | export function callbackUrl(request: Request): string { | |
| 20 | return `${new URL(request.url).origin}/auth/github/callback`; | |
| 21 | } |