Fix YAML anchor/alias generation in GitHub Actions workflow on triggers#7
Merged
Fix YAML anchor/alias generation in GitHub Actions workflow on triggers#7
on triggers#7Conversation
PyYAML emitted anchor/alias pairs (&id001 / *id001) when the same branches list object was reused in both push and pull_request triggers. GitHub Actions does not support YAML aliases and the output was confusing. - Add _NoAliasDumper (yaml.Dumper subclass with ignore_aliases=True) to cli/scaffold_gha.py and mcp_server/server.py - Use the new dumper in both yaml.dump() call sites - Add 3 new regression tests verifying no anchors/aliases in YAML output Co-authored-by: chefgs <7605658+chefgs@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix unknown branch IDs in GitHub Actions workflow
Fix YAML anchor/alias generation in GitHub Actions workflow Mar 4, 2026
on triggers
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.
PyYAML detects that the same
brancheslist object is referenced in bothpushandpull_requesttrigger blocks and collapses them into an anchor/alias pair, producing invalid-for-GitHub-Actions output:Changes
cli/scaffold_gha.py— Added_NoAliasDumper(yaml.Dumper)that overridesignore_aliases()to always returnTrue; wired it into theyaml.dump()call that serialises the final workflow dict.mcp_server/server.py— Same_NoAliasDumperpattern applied to theyaml.dump()call ingenerate_github_actions_workflow.tests/test_comprehensive.py— Three regression tests asserting&id/*idare absent from serialised output and that both trigger blocks carry explicit branch lists (TestScaffoldGHA× 2,TestMCPServerGHA× 1).🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.