Fix YAML indentation bug in AI prompt template substitution - #88
Closed
dblock wants to merge 1 commit into
Closed
Conversation
actions/ai-inference@v1 substitutes {{var}} placeholders as raw text
into the prompt YAML file before parsing it as YAML. Since the diff/
diff-stat files started at column 0, injecting their multi-line
content broke the indentation of the enclosing `content: |-` block
scalar in commit-message.prompt.yml (which expects continuation
lines to be indented), causing "Failed to parse prompt file: bad
indentation of a mapping entry" at runtime.
Indent every line of the diff/diff-stat files with 6 spaces (to
match the prompt file's block scalar indentation) before writing
them out, so the substituted content stays inside the block.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
Author
|
Superseded by #89, which includes this same YAML indentation fix as part of the Copilot CLI migration. |
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.
Problem
The
update.ymlworkflow's AI commit-message generation step (#87) is fragile:actions/ai-inference@v1substitutes{{diff_stat}}/{{diff}}placeholders as raw text into the prompt YAML file before parsing it as YAML. Since the diff/diff-stat files were written starting at column 0, injecting multi-line content can break the indentation of the enclosingcontent: |-block scalar incommit-message.prompt.yml, causing:This exact failure mode was confirmed in the sibling workflow in slack-ruby/slack-ruby-client#592 (https://github.com/slack-ruby/slack-ruby-client/actions/runs/31552877245/job/93979138338).
Fix
Pipe the diff/diff-stat output through
sed 's/^/ /'(6 spaces, matching the prompt file's block scalar indentation) before writing them to the files consumed viafile_input, so the substituted content stays inside the block and parses correctly.