← gitpulse
Bug Fix·Pushed May 1, 2026·XS

stories path resolved for ci builds

The action was writing stories to the wrong directory in CI — outside the site's build scope, causing static generation to fail.

The site was building with zero stories because the action wrote them to the wrong location. When [[code]]yarn workspace @gitpulse/action analyze[[/code]] runs, Node's working directory points to the [[code]]action/[[/code]] subdirectory, so [[code]]outDir[[/code]] resolved to [[code]]action/site/src/content/stories/[[/code]] instead of [[code]]site/src/content/stories/[[/code]] at the repo root. The Next.js build, running from the root, never saw those stories — and CI failed with "Page /stories/[id] is missing generateStaticParams." The fix introduces a tiered fallback for [[code]]repoDir[[/code]]: first checking an explicit [[code]]GITPULSE_REPO_DIR[[/code]] environment variable, then [[code]]GITHUB_WORKSPACE[[/code]] (which Actions sets automatically), then falling back to [[code]]cwd[[/code]] for local development. [[code]]outDir[[/code]] is now computed relative to [[code]]repoDir[[/code]] consistently, regardless of where the script executes from. in the @gitpulse/action package, in the configuration loading logic
Technical description
The bug lived in [[code ref=1]]loadConfig[[/code]] within [[code]]action/src/config.ts[[/code]]. When the action ran via [[code]]yarn workspace[[/code]], Node's working directory changed to the workspace root ([[code]]action/[[/code]]), so the [[code]]outDir[[/code]] path resolved incorrectly: ```` process.cwd() + 'site/src/content/stories' // became: action/site/src/content/stories/ // ← wrong! ```` The site build, running from the repo root, couldn't find any generated stories — leading to the "missing generateStaticParams" error in CI. The fix computes [[code]]repoDir[[/code]] using a three-tier fallback that handles different execution contexts: ````typescript const repoDir = env.GITPULSE_REPO_DIR ?? env.GITHUB_WORKSPACE ?? process.cwd(); ```` - [[code]]GITPULSE_REPO_DIR[[/code]]: explicit override for unusual setups - [[code]]GITHUB_WORKSPACE[[/code]]: set automatically by GitHub Actions when running as a step - [[code]]process.cwd()[[/code]]: fallback for local dev runs executed from the repo root [[code]]outDir[[/code]] now uses [[code]]repoDir[[/code]] as its base, ensuring stories land in the correct location whether the action runs in CI, locally via yarn workspace, or directly from the repo root. **Files at a Glance:** - [[code]]action/src/config.ts[[/code]]: Fixed path resolution for [[code]]repoDir[[/code]] and [[code]]outDir[[/code]] to handle yarn workspace execution context

Categories

  • Bug Fix (70%)Fixes incorrect directory path causing stories to be written outside the site's build scope in CI
  • CI/CD (20%)Specifically addresses CI behavior with GITHUB_WORKSPACE and the generateStaticParams error
  • Configuration (10%)Involves environment variable handling as a core part of the solution