Skip to content

Ensure static site builds write .nojekyll#61

Merged
PrzemyslawKlys merged 1 commit intov2-speedgonzalesfrom
fix/web-build-nojekyll-20260206
Feb 6, 2026
Merged

Ensure static site builds write .nojekyll#61
PrzemyslawKlys merged 1 commit intov2-speedgonzalesfrom
fix/web-build-nojekyll-20260206

Conversation

@PrzemyslawKlys
Copy link
Member

Summary

  • write .nojekyll at the root of every WebSiteBuilder.Build output
  • keeps GitHub Pages from treating static output as Jekyll input
  • add regression test to ensure marker is always produced

Validation

  • dotnet test PowerForge.Tests/PowerForge.Tests.csproj -c Release --filter FullyQualifiedName~WebSiteAuditOptimizeBuildTests

Why

  • IX deploy workflow verifies _site/.nojekyll; missing marker caused Pages build verification failures on master.

Copilot AI review requested due to automatic review settings February 6, 2026 09:47
@claude
Copy link

claude bot commented Feb 6, 2026

Code Review Summary

This PR adds the .nojekyll marker file to static site builds to prevent GitHub Pages from treating output as Jekyll input. The implementation is clean and well-tested.

✅ Strengths

  1. Clear Purpose: Solves a specific deployment issue where missing .nojekyll caused GitHub Pages build verification failures
  2. Proper Test Coverage: Includes a comprehensive regression test (Build_WritesNoJekyllMarkerAtSiteRoot) that follows existing test patterns
  3. Good Placement: The EnsureNoJekyllFile method is called at the right point in the build process (WebSiteBuilder.cs:90), after all content generation
  4. Idempotent: The if (!File.Exists(markerPath)) check prevents overwriting if the file already exists
  5. Consistent Style: Follows the existing codebase patterns for similar helper methods

📝 Code Quality

WebSiteBuilder.cs (PowerForge.Web/Services/WebSiteBuilder.cs:102-107)

  • Clean, focused method that does exactly one thing
  • Appropriate use of private static visibility
  • Proper null-coalescing with string.Empty for empty file content

WebSiteAuditOptimizeBuildTests.cs (PowerForge.Tests/WebSiteAuditOptimizeBuildTests.cs:268-318)

  • Test follows the AAA pattern (Arrange, Act, Assert)
  • Proper cleanup with try-finally block
  • Uses unique temp directories to avoid conflicts
  • Minimal test setup with just enough configuration to exercise the feature

🔍 Observations

  1. No Performance Concerns: Writing a single empty file is negligible overhead
  2. No Security Issues: The marker file is a standard GitHub Pages convention
  3. Backwards Compatible: Existing builds will now include the marker without breaking changes

💡 Minor Suggestions (Optional)

  1. Consider a comment explaining why the file check exists (though the method name is self-documenting):
private static void EnsureNoJekyllFile(string outputRoot)
{
    // GitHub Pages requires .nojekyll to skip Jekyll processing
    var markerPath = Path.Combine(outputRoot, ".nojekyll");
    if (!File.Exists(markerPath))
        File.WriteAllText(markerPath, string.Empty);
}
  1. Alternative implementation (purely stylistic, current version is fine):
private static void EnsureNoJekyllFile(string outputRoot)
{
    var markerPath = Path.Combine(outputRoot, ".nojekyll");
    File.WriteAllText(markerPath, string.Empty);  // Overwrites if exists
}

Since the file is always empty, overwriting is harmless and removes a check.

✅ Recommendation

LGTM - Approve and merge

This is a focused, well-implemented fix with appropriate test coverage. The change is low-risk and solves a real deployment issue.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 92d2a0381f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +105 to +106
if (!File.Exists(markerPath))
File.WriteAllText(markerPath, string.Empty);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle existing .nojekyll directory before writing marker

EnsureNoJekyllFile only checks File.Exists, but File.Exists(".../.nojekyll") returns false when that path is an existing directory, so File.WriteAllText then throws and aborts the build. Because Build does not clean outDir, this can happen on incremental builds if a previous run (or copied content/assets) left a .nojekyll/ directory at the root, turning this new marker step into a hard failure instead of a no-op.

Useful? React with 👍 / 👎.

@PrzemyslawKlys PrzemyslawKlys merged commit 20c57f3 into v2-speedgonzales Feb 6, 2026
11 checks passed
@PrzemyslawKlys PrzemyslawKlys deleted the fix/web-build-nojekyll-20260206 branch February 6, 2026 09:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures that static site builds always include a .nojekyll marker file at the output root to prevent GitHub Pages from treating the static output as Jekyll input. This addresses deployment verification failures that occurred when the marker was missing.

Changes:

  • Added EnsureNoJekyllFile method to write .nojekyll marker at the site root during build
  • Integrated the marker file creation into the WebSiteBuilder.Build process
  • Added regression test to verify the marker is always produced

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
PowerForge.Web/Services/WebSiteBuilder.cs Adds EnsureNoJekyllFile helper method and calls it during the build process to create the .nojekyll marker file
PowerForge.Tests/WebSiteAuditOptimizeBuildTests.cs Adds test Build_WritesNoJekyllMarkerAtSiteRoot to verify the marker file is created during site builds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants