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

Story generation path fixed in CI

The GitHub Action was writing generated story files to the wrong directory in CI environments. The site build couldn't find them, causing static generation to fail. The fix correctly resolves paths relative to the repository root.

When running as a GitHub Action with yarn workspaces, the process working directory shifts to the workspace directory ([[code]]action/[[/code]]), causing relative paths to resolve incorrectly. Story files were being written to [[code]]action/site/src/content/stories/[[/code]] instead of the repository root's site directory, making them invisible to the build. The fix prioritizes the [[code]]GITHUB_WORKSPACE[[/code]] environment variable (set by Actions) or an explicit [[code]]GITPULSE_REPO_DIR[[/code]] when available, falling back to [[code]]cwd[[/code]] only for local development runs from the repo root. Output paths are now computed relative to the repository root consistently. This resolves the "Page /stories/[id] is missing generateStaticParams" error that was occurring in CI — the site build now sees all generated stories as expected.
Technical description
## What Changed The [[code ref=1]]loadConfig[[/code]] function in [[code]]action/src/config.ts[[/code]] had a path resolution bug. When the action runs via yarn workspace in CI, [[code]]process.cwd()[[/code]] returns the workspace directory ([[code]]action/[[/code]]), so computed paths like [[code]]${process.cwd()}/site/src/content/stories[[/code]] resolved to [[code]]action/site/src/content/stories/[[/code]] instead of the actual repository root. ## The Fix Two changes were made to [[code]]loadConfig[[/code]]: 1. **Explicit repoDir resolution**: A new [[code]]repoDir[[/code]] variable is computed by checking environment variables in priority order: [[code]]GITPULSE_REPO_DIR[[/code]] → [[code]]GITHUB_WORKSPACE[[/code]] → [[code]]process.cwd()[[/code]]. The [[code]]GITHUB_WORKSPACE[[/code]] variable is automatically set by GitHub Actions to the repository checkout location. 2. **Consistent outDir computation**: The [[code]]outDir[[/code]] now uses [[code]]repoDir[[/code]] as its base instead of calling [[code]]process.cwd()[[/code]] directly. ````typescript file=action/src/config.ts + // Resolve repoDir: explicit env, then GITHUB_WORKSPACE (set in Actions), + // then cwd. Yarn workspace scripts run with cwd set to the workspace + // dir, so we can't trust cwd in CI. + const repoDir = env.GITPULSE_REPO_DIR ?? env.GITHUB_WORKSPACE ?? process.cwd(); return { - repoDir: env.GITPULSE_REPO_DIR ?? process.cwd(), + repoDir, - outDir: env.GITPULSE_OUT_DIR ?? [[code]]${process.cwd()}/site/src/content/stories[[/code]], + outDir: env.GITPULSE_OUT_DIR ?? [[code]]${repoDir}/site/src/content/stories[[/code]], ... ```` ## Why This Matters In GitHub Actions, the working directory for a step is set to the repository root. However, when running yarn workspace commands, the cwd can be overridden to the workspace directory, breaking relative path resolution. By explicitly using [[code]]GITHUB_WORKSPACE[[/code]] as the authoritative source for the repo location, the action now works correctly regardless of how it's invoked. ## Files at a Glance - [[code]]action/src/config.ts[[/code]]: Fixed path resolution for [[code]]repoDir[[/code]] and [[code]]outDir[[/code]] to use the correct repository root in CI environments

Categories

  • Bug Fix (85%)This commit fixes a path resolution bug that caused CI builds to fail. Story files were being written to the wrong directory, making them invisible to the site build.
  • CI/CD (15%)The bug manifested specifically in CI environments where yarn workspace sets cwd to the workspace directory, breaking relative path resolution.