ci: add PR validation workflows

Merging PR #30
This commit is contained in:
Abhimanyu Saharan
2026-02-07 12:32:25 +05:30
committed by GitHub
29 changed files with 390 additions and 30 deletions

View File

@@ -2,7 +2,7 @@
import { useCallback, useMemo, useState } from "react";
import { useAuth } from "@clerk/nextjs";
import { useAuth } from "@/auth/clerk";
import { useQueryClient } from "@tanstack/react-query";
import { Clock } from "lucide-react";

View File

@@ -1,6 +1,6 @@
"use client";
import { SignInButton, SignedIn, SignedOut } from "@clerk/nextjs";
import { SignInButton, SignedIn, SignedOut } from "@/auth/clerk";
import { HeroCopy } from "@/components/molecules/HeroCopy";
import { Button } from "@/components/ui/button";

View File

@@ -1,7 +1,7 @@
"use client";
import Image from "next/image";
import { SignOutButton, useUser } from "@clerk/nextjs";
import { SignOutButton, useUser } from "@/auth/clerk";
import { LogOut } from "lucide-react";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";

View File

@@ -0,0 +1,30 @@
"use client";
import { ClerkProvider } from "@clerk/nextjs";
import type { ReactNode } from "react";
function isLikelyValidClerkPublishableKey(key: string | undefined): key is string {
if (!key) return false;
// Clerk publishable keys look like: pk_test_... or pk_live_...
// In CI we want builds to stay secretless; if the key isn't present/valid,
// we skip Clerk entirely so `next build` can prerender.
//
// Note: Clerk appears to validate key *contents*, not just shape. We therefore
// use a conservative heuristic to avoid treating obvious placeholders as valid.
const m = /^pk_(test|live)_([A-Za-z0-9]+)$/.exec(key);
if (!m) return false;
const body = m[2];
if (body.length < 16) return false;
if (/^0+$/.test(body)) return false;
return true;
}
export function AuthProvider({ children }: { children: ReactNode }) {
const publishableKey = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY;
if (!isLikelyValidClerkPublishableKey(publishableKey)) {
return <>{children}</>;
}
return <ClerkProvider publishableKey={publishableKey}>{children}</ClerkProvider>;
}

View File

@@ -2,7 +2,7 @@
import type { ReactNode } from "react";
import { SignedIn, useUser } from "@clerk/nextjs";
import { SignedIn, useUser } from "@/auth/clerk";
import { BrandMark } from "@/components/atoms/BrandMark";
import { UserMenu } from "@/components/organisms/UserMenu";

View File

@@ -2,7 +2,7 @@
import type { ReactNode } from "react";
import { SignedIn } from "@clerk/nextjs";
import { SignedIn } from "@/auth/clerk";
import { BrandMark } from "@/components/atoms/BrandMark";
import { UserMenu } from "@/components/organisms/UserMenu";