Skip to content

Install yamllint and fix trailing spaces in generated YAML#43545

Closed
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/install-yamllint-and-fix-warnings
Closed

Install yamllint and fix trailing spaces in generated YAML#43545
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/install-yamllint-and-fix-warnings

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Generated .lock.yml files had widespread trailing-space violations — blank lines inside run: | blocks, script: | blocks, and heredoc prompt content were emitted as indented-whitespace lines instead of bare newlines. This PR adds yamllint to the lint pipeline and fixes the root causes in the Go generators.

Generator fixes

  • header.go — trim trailing spaces from ASCII logo lines
  • compiler_yaml.go — normalize trailing newlines after yaml.String()
  • frontmatter_extraction_yaml.goindentYAMLLines emits bare \n for blank lines instead of indent + "\n"
  • compiler_github_actions_steps.go — blank lines in script: | blocks emit "\n" not indent + " \n"
  • mcp_renderer_guard.go, mcp_setup_generator.go, codex_mcp.go, mcp_renderer_builtin.go, mcp_renderer_github.go, codex_engine.goWriteString(" \n")WriteString("\n") across ~20 occurrences
  • unified_prompt_step.go — three write loops (inline sections, conditional sections, user prompt chunks) now guard blank lines:
    // Before
    yaml.WriteString("          ")
    yaml.WriteString(line)
    yaml.WriteByte('\n')
    
    // After
    if strings.TrimSpace(line) == "" {
        yaml.WriteByte('\n')
    } else {
        yaml.WriteString("          ")
        yaml.WriteString(line)
        yaml.WriteByte('\n')
    }
  • compiler_main_job.go — fix permissions 10-space indentation bug: perms.RenderToYAML() returns 6-space-indented values; wrapping with filterJobLevelPermissions() normalizes to 2-space before indentYAMLLines(" ") applies, giving the correct 6-space total

Infrastructure

  • .yamllint.yml — new config: indent-sequences: whatever (accepts both GitHub Actions indented sequences and compact goccy/go-yaml sequences), comments-indentation: disable, trailing-spaces: enable, empty-lines max-end: 0
  • Makefileinstall-yamllint and lint-yaml targets added; lint-yaml wired into lint, install-yamllint into deps-dev
  • All 258 workflows recompiled; WASM golden files regenerated

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review July 5, 2026 13:09
Copilot AI review requested due to automatic review settings July 5, 2026 13:09
@pelikhan pelikhan closed this Jul 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 tightens YAML hygiene for gh-aw’s generated workflow outputs by eliminating trailing-whitespace blank lines in multi-line YAML blocks and enforcing the rule via yamllint in the repo’s lint pipeline.

Changes:

  • Add yamllint config + Makefile targets, and wire YAML linting into make lint.
  • Fix multiple Go generators to emit bare blank lines ("\n") instead of indented whitespace-only lines, and normalize the final file newline.
  • Regenerate compiled .lock.yml workflows and refresh WASM golden fixtures to reflect the whitespace normalization.
Show a summary per file
File Description
pkg/workflow/header.go Trims trailing whitespace from ASCII logo lines to avoid trailing-space violations in generated headers.
pkg/workflow/compiler_yaml.go Normalizes generated YAML to exactly one trailing newline to satisfy yamllint empty-lines.max-end.
pkg/workflow/frontmatter_extraction_yaml.go Makes indentYAMLLines emit truly blank lines (no indentation) to avoid trailing spaces.
pkg/workflow/frontmatter_extraction_yaml_test.go Updates expected output to match new blank-line handling in indentYAMLLines.
pkg/workflow/compiler_github_actions_steps.go Writes blank lines inside `script:
pkg/workflow/unified_prompt_step.go Avoids emitting indentation on blank lines when writing heredoc/prompt content into YAML blocks.
pkg/workflow/compiler_main_job.go Normalizes job-level permissions indentation via filterJobLevelPermissions to avoid mis-indentation and keep formatting consistent.
pkg/workflow/mcp_setup_generator.go Replaces whitespace-only blank lines in generated `run:
pkg/workflow/mcp_renderer_guard.go Avoids whitespace-only blank lines when rendering TOML sections into YAML block content.
pkg/workflow/mcp_renderer_github.go Avoids whitespace-only blank lines in GitHub MCP TOML rendering.
pkg/workflow/mcp_renderer_builtin.go Avoids whitespace-only blank lines in builtin MCP TOML rendering sections.
pkg/workflow/codex_mcp.go Avoids whitespace-only blank lines while rendering Codex MCP config blocks (TOML + JSON generation sections).
pkg/workflow/codex_engine.go Avoids whitespace-only blank lines before [shell_environment_policy] TOML section.
.yamllint.yml Adds repo yamllint configuration aligned to generated workflow formatting constraints.
Makefile Adds install-yamllint / lint-yaml and wires lint-yaml into lint and yamllint install into deps-dev.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/with-imports.golden Updates golden output to reflect whitespace normalization (removal of trailing whitespace-only blank lines).
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden Updates golden output to reflect whitespace normalization.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/playwright-cli-mode.golden Updates golden output to reflect whitespace normalization.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/basic-copilot.golden Updates golden output to reflect whitespace normalization.
pkg/workflow/testdata/TestWasmGolden_AllEngines/pi.golden Updates golden output to reflect whitespace normalization.
pkg/workflow/testdata/TestWasmGolden_AllEngines/gemini.golden Updates golden output to reflect whitespace normalization.
pkg/workflow/testdata/TestWasmGolden_AllEngines/copilot.golden Updates golden output to reflect whitespace normalization.
pkg/workflow/testdata/TestWasmGolden_AllEngines/claude.golden Updates golden output to reflect whitespace normalization.
.github/workflows/video-analyzer.lock.yml Regenerated lock file reflecting trailing-space fixes (blank lines no longer contain indentation).
.github/workflows/update-astro.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/test-workflow.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/test-quality-sentinel.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/test-project-url-default.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/test-dispatcher.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/smoke-copilot-sub-agents.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/smoke-copilot-sdk.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/smoke-ci.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/repo-tree-map.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/github-remote-mcp-auth-test.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/github-mcp-tools-report.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/firewall.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/example-permissions-warning.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/example-failure-category-filter.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/daily-team-status.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/daily-model-inventory.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/daily-max-ai-credits-test.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/daily-credit-limit-test.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/daily-byok-ollama-test.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/daily-architecture-diagram.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/daily-malicious-code-scan.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/copilot-pr-prompt-analysis.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/copilot-pr-merged-report.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/copilot-centralization-optimizer.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/copilot-centralization-drilldown.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/cli-consistency-checker.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/bot-detection.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/blog-auditor.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/architecture-guardian.lock.yml Regenerated lock file reflecting trailing-space fixes.
.github/workflows/agentics-maintenance.yml Regenerated workflow header/logo whitespace cleanup.
.github/workflows/agentic-auto-upgrade.yml Regenerated workflow header/logo whitespace cleanup.
.github/workflows/agentic_commands.yml Regenerated workflow header/logo whitespace cleanup.

Review details

Tip

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

  • Files reviewed: 274/284 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread Makefile
Comment on lines +601 to +617
# Install yamllint for YAML linting
.PHONY: install-yamllint
install-yamllint:
@echo "Installing yamllint..."
@pip3 install yamllint==1.38.0 --quiet
@echo "✓ yamllint installed"

# Lint generated lock files with yamllint
.PHONY: lint-yaml
lint-yaml:
@echo "Linting generated lock files with yamllint..."
@if ! command -v yamllint >/dev/null 2>&1; then \
echo "yamllint is not installed. Run 'make install-yamllint' to install."; \
exit 1; \
fi
@yamllint -c .yamllint.yml .github/workflows/*.lock.yml
@echo "✓ yamllint passed"
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.

3 participants