Skip to content

ci(templates): LHCI workflow is dead on arrival in monorepo layout #115

Description

@spencer-osbrjp

Problem

Scaffold copies audit templates into webDir (pkg/scaffold.go — the cfg.Audit != "none" block). In monorepo layout webDir is apps/web, so the Lighthouse workflow lands at apps/web/.github/workflows/lhci.yml. GitHub only runs workflows from the repo root's .github/workflows/, so scaffolded monorepo projects silently get no Lighthouse CI at all.

The workflow's assumptions are also flat-layout-shaped even if it were moved:

  • run steps (install, build, lhci autorun) execute at the repo root with no working-directory: apps/web.
  • The affected-pages step (ci(templates): LHCI workflow should audit only the pages a PR affects #113) diffs paths like src/pages/**, but in a monorepo changed files are prefixed apps/web/src/pages/**, so every diff falls through to the full-audit fallback.
  • An apps/api-only PR can't change frontend Lighthouse scores but would still trigger a full audit — the inverse of the resource optimization we just shipped.

Proposal

When cfg.Layout.IsMonorepo():

  • Emit the workflow at the repo root .github/workflows/ (keep lighthouserc.json in apps/web).
  • Template a path prefix into the workflow: working-directory: apps/web on run steps (or cd apps/web), apps/web/src/pages (Astro) / apps/web/app/pages (Nuxt) as pages_dir, and strip the prefix when mapping routes.
  • Add paths: ['apps/web/**', 'packages/**', ...] (or extend paths-ignore) so backend-only PRs skip the audit entirely.

Context

Follow-up to #112 and #113 — pre-existing placement bug noticed while implementing the affected-pages narrowing (PR #114).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions