Closed
Install yamllint and fix trailing spaces in generated YAML#43545
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
July 5, 2026 13:09
View session
Contributor
There was a problem hiding this comment.
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
yamllintconfig + Makefile targets, and wire YAML linting intomake 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.ymlworkflows 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 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated
.lock.ymlfiles had widespread trailing-space violations — blank lines insiderun: |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 linescompiler_yaml.go— normalize trailing newlines afteryaml.String()frontmatter_extraction_yaml.go—indentYAMLLinesemits bare\nfor blank lines instead ofindent + "\n"compiler_github_actions_steps.go— blank lines inscript: |blocks emit"\n"notindent + " \n"mcp_renderer_guard.go,mcp_setup_generator.go,codex_mcp.go,mcp_renderer_builtin.go,mcp_renderer_github.go,codex_engine.go—WriteString(" \n")→WriteString("\n")across ~20 occurrencesunified_prompt_step.go— three write loops (inline sections, conditional sections, user prompt chunks) now guard blank lines:compiler_main_job.go— fix permissions 10-space indentation bug:perms.RenderToYAML()returns 6-space-indented values; wrapping withfilterJobLevelPermissions()normalizes to 2-space beforeindentYAMLLines(" ")applies, giving the correct 6-space totalInfrastructure
.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: 0Makefile—install-yamllintandlint-yamltargets added;lint-yamlwired intolint,install-yamllintintodeps-dev