Skip to content

fix(ci): fix YAML parse error in components-independence workflow#310

Merged
adnaan merged 2 commits intomainfrom
fix/ci-components-independence
Apr 6, 2026
Merged

fix(ci): fix YAML parse error in components-independence workflow#310
adnaan merged 2 commits intomainfrom
fix/ci-components-independence

Conversation

@adnaan
Copy link
Copy Markdown
Contributor

@adnaan adnaan commented Apr 6, 2026

Summary

  • The heredoc in the "Test external import" step had Go code starting at column 0 inside a YAML literal block scalar (run: |), which broke GitHub's YAML parser
  • Replaced the cat <<'GOEOF' heredoc with printf to keep all content at the proper YAML indentation level
  • This fixes the "workflow file issue" failures that appeared on every push to main

Root cause

YAML literal block scalars require all content lines to be indented at least as far as the first content line. The Go code inside the heredoc (e.g., package main) had zero indentation, terminating the block scalar early and causing a YAML parse error.

Test plan

  • Verify CI no longer shows "workflow file issue" failures on push to main
  • Verify the components-independence workflow runs correctly on a PR touching components/

🤖 Generated with Claude Code

The heredoc content inside the "Test external import" step's `run: |`
block had Go code at column 0, which broke the YAML literal block
scalar (content must be indented at least to the base level). Replace
the heredoc with printf to keep all content properly indented.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 6, 2026 05:11
Copy link
Copy Markdown

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

Fixes a GitHub Actions workflow YAML parse error in the components-independence CI workflow so it can run reliably on PRs that touch components/.

Changes:

  • Replaces a heredoc that produced unindented lines (breaking YAML parsing) with a single printf command to generate main.go at the correct indentation level.

@claude
Copy link
Copy Markdown

claude bot commented Apr 6, 2026

Code Review

This is a clean, focused fix that correctly addresses the YAML parsing issue in the components-independence workflow.

What the fix does

Replacing the heredoc (cat <<'GOEOF') with printf avoids the YAML literal block scalar problem where the heredoc terminator (GOEOF) at column 0 causes GitHub's YAML parser to terminate the block early — meaning the cat command (and potentially following shell commands) gets truncated from the parsed script.

Assessment

Correctness ✓ The fix is functionally equivalent. printf always interprets format-string escape sequences (\n, \t), so the generated main.go will be identical to what the heredoc produced.

Single-quote safety ✓ The Go snippet contains no single quotes, so wrapping in '...' is safe.

Readability concern (minor)

The one-liner is harder to read and maintain. If someone needs to change the Go snippet in the future (e.g., add an import), they have to carefully edit the \n/\t-escaped string. A multi-line printf with line continuations would be easier to work with:

printf '%s\n' \
  'package main' \
  '' \
  'import (' \
  $'\t"fmt"' \
  $'\t"github.com/livetemplate/lvt/components"' \
  ')' \
  '' \
  'func main() {' \
  $'\tfmt.Println(components.Version())' \
  '}' \
  > main.go

That said, for a CI test fixture this simple, the single-line form is acceptable — just a style trade-off.

Overall

The root cause is correctly identified, the fix is minimal and accurate, and the PR description is clear. No functional or security concerns. Good to merge.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude bot commented Apr 6, 2026

PR Review

Summary

This PR fixes a real CI breakage: the heredoc inside a YAML run: | block placed Go code at column 0, which caused the YAML parser to terminate the literal block scalar early. The root cause is correctly identified and the fix is accurate.


.github/workflows/components-independence.yml

The fix is correct. printf always interprets escape sequences for newline and tab, so the generated main.go is byte-for-byte identical to the heredoc output. The Go snippet contains no single quotes, so the single-quote wrapping is safe.

Readability / maintainability nit: The escaped one-liner is hard to read and harder to diff if the test program ever grows. A more maintainable alternative would be to store the file in the repo and copy it in the workflow step. This keeps the Go code as actual Go code (syntax-highlighted, searchable, diffable) and removes any escaping concerns. For a one-off CI test fixture this is a minor point, but worth considering if the snippet ever needs to grow.

Neither this nor any other alternative is required for this fix to land — the one-liner works — flagging for future reference only.


testing/chrome.go

Pure cosmetic alignment of the const block after clientFetchTimeout was previously added without updating column alignment. No logic changes, looks good.


Overall

  • Root cause correctly identified
  • Fix is minimal and accurate
  • No security concerns
  • No test coverage gaps (this is a CI config fix)

Good to merge.

@adnaan adnaan merged commit e7c8582 into main Apr 6, 2026
2 checks passed
@adnaan adnaan deleted the fix/ci-components-independence branch April 6, 2026 05:25
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