Skip to content

CI: add a next build step so 'use server' violations can't reach main #523

Closed

Description

@gkhngyk

Problem

The web CI job runs Prettier, ESLint, tsc --noEmit and Vitest — but never next build. Meanwhile the Vercel check on PR branches is canceled by the ignored-build-step, so nothing in the PR pipeline executes the Next.js compiler. A whole class of build-time-only errors sails through green CI and breaks the production build on merge to main.

Concrete near-miss: PR #521 exported a sync function from a 'use server' module (web/src/lib/actions/tracking.ts). Next.js only allows async function exports there — next build fails with "Only async functions are allowed to be exported in a 'use server' file" — but typecheck, lint and tests all passed, and it was only caught in review. Other examples in this class: invalid 'use client'/'use server' boundaries, client components importing server-only modules, and route-conflict errors.

Fix

Add a build step to the web job in .github/workflows/ci.yml after the Vitest step:

  • yarn build (i.e. next build), with any required env vars stubbed — the build must not need real secrets. If some are required at build time, provide placeholder values in the workflow env and document why.
  • Keep the job green on today's main — if the current tree doesn't build cleanly with stubbed env, fixing that is part of this issue.
  • Watch CI duration: if the build pushes the job well past ~5 minutes, enable Next.js build caching (actions/cache on .next/cache) in the same PR.

Acceptance criteria

  • A PR exporting a sync function from a 'use server' module fails the web CI job.
  • The web job passes on current main.
  • No real secrets are added to the workflow.

Getting started

See CONTRIBUTING.md for setup. Comment here to claim the issue before opening a PR.

Activity

  1. added
    enhancement
    good first issue
    help wanted
    on Jul 23, 2026
  2. abdulm5 commented on Jul 23, 2026

    @abdulm5
    Contributor

    Hi! I’d like to work on this issue

  3. gkhngyk commented on Jul 24, 2026

    @gkhngyk
    ContributorAuthor

    Thanks for picking this up @abdulm5! Quick pointers: the web job lives in .github/workflows/ci.yml ("web — format, lint & typecheck") — a next build step can go there or in a separate job. The main gotcha is that the build needs Supabase env vars at build time; dummy placeholder values are fine since CI only cares about compilation, not runtime. PR #521 is a good example of the error class this will catch (a sync export from a 'use server' module passes typecheck but fails the production build).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions