Skip to content

Commit da79748

Browse files
committed
Pass GITHUB_TOKEN and mount .git directory in Docker build step for better compatibility and logging
1 parent 472da7e commit da79748

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

build.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,23 @@
4343
// Convert Windows paths to Docker-compatible format (forward slashes)
4444
var astroPath = Path.Combine(repoRoot, "astro").Replace('\\', '/');
4545
var outputPath = wwwrootDir.Replace('\\', '/');
46+
var gitPath = Path.Combine(repoRoot, ".git").Replace('\\', '/');
47+
48+
// Pass GITHUB_TOKEN into the container if set
49+
var githubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN") ?? "";
4650

4751
// Use Docker to build Astro - consistent across all platforms
4852
// Use Debian-based image (not Alpine) for better compatibility with native modules
4953
// Increase Node.js memory limit to handle large builds
54+
// Mount .git so git log works inside the container
5055
await RunAsync("docker",
5156
"run --rm " +
5257
$"-v \"{astroPath}:/app\" " +
5358
$"-v \"{outputPath}:/output\" " +
59+
$"-v \"{gitPath}:/app/.git\" " +
5460
"-w /app " +
5561
"-e NODE_OPTIONS=\"--max-old-space-size=8192\" " +
62+
$"-e GITHUB_TOKEN=\"{githubToken}\" " +
5663
"node:24-slim " +
5764
"sh -c \"apt-get update && apt-get install -y git && npm ci && npm run build && cp -r dist/. /output/\"",
5865
configureEnvironment: env => env.Add("MSYS_NO_PATHCONV", "1"));

0 commit comments

Comments
 (0)