Skip to content

Fix invalid YAML syntax in agent-fix.yml workflow - #32

Open
Sasank1236 wants to merge 1 commit into
sreerevanth:mainfrom
Sasank1236:fix/agent-fix-workflow-yaml-syntax
Open

Fix invalid YAML syntax in agent-fix.yml workflow#32
Sasank1236 wants to merge 1 commit into
sreerevanth:mainfrom
Sasank1236:fix/agent-fix-workflow-yaml-syntax

Conversation

@Sasank1236

@Sasank1236 Sasank1236 commented Jul 15, 2026

Copy link
Copy Markdown

Problem

.github/workflows/agent-fix.yml fails to run at all, with GitHub
reporting:

Invalid workflow file: .github/workflows/agent-fix.yml#L73
You have an error in your yaml syntax on line 73

Root cause

The Post Comment on Issue step uses a YAML block scalar (script: |)
whose indentation baseline is set by its first line at 12 spaces.
Several lines inside the two JS template literals (the success/failure
comment bodies) were written at column 0 to keep the rendered GitHub
comment clean:

commentBody = `Hello @${issuee},

I have successfully fixed the issue! 🎉
...

Any non-blank line with less indentation than the block's baseline
terminates the block scalar early. Since these lines had 0 indentation
against a 12-space baseline, YAML stopped parsing the script block
mid-way through, producing the syntax error and preventing the
workflow from running at all — not just failing a step, but failing
to even start.

Fix

Indented every non-blank line of both template literals to 12 spaces
so they stay inside the block scalar. This is purely a YAML-level fix:
YAML strips exactly the block's base indent from each line when
extracting the string, so the actual comment text posted to issues is
byte-identical to before.

Verified

import yaml
data = yaml.safe_load(open('.github/workflows/agent-fix.yml'))
# parses successfully
script = data['jobs']['agent-fix']['steps'][-1]['with']['script']
# confirmed extracted string matches original comment text exactly,
# word for word, with no stray leading whitespace

Note

This fixes the workflow file's validity so it can run at all. I
wasn't able to trigger a real issues: opened/labeled event with the
required ANTHROPIC_API_KEY / GITHUB_TOKEN secrets to test full
runtime behavior — recommend watching the next real trigger (or firing
a test issue with the agent-fix label) to confirm it completes
end-to-end.

Summary by CodeRabbit

  • Style
    • Improved the formatting of automated issue comments for clearer readability.
    • Standardized success and failure messages with consistent line breaks and layout.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The workflow updates the Post Comment on Issue step to construct success and failure comment bodies with consistent multi-line template literals before submitting them through createComment.

Changes

Issue Comment Formatting

Layer / File(s) Summary
Format issue comment templates
.github/workflows/agent-fix.yml
Success and failure comment bodies use aligned multi-line template literals, while the existing comment submission call remains unchanged.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested labels: ELUSOC

Poem

A bunny trims each comment line,
Making every break align just fine.
Success hops in, failure too,
The posting call stays steady and true.
“Neat formatting!” the rabbit chews.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: fixing invalid YAML syntax in the agent-fix.yml workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/agent-fix.yml:
- Around line 71-89: Update the success and failure comment-body construction in
the workflow to avoid preserving YAML indentation in posted Markdown. Build each
message from unindented line strings joined with "\n" (or use an existing safe
dedent helper), while preserving the current interpolated values, formatting,
and fallback messages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f5c5b7fe-2064-465c-ae16-6c7e5cd51be6

📥 Commits

Reviewing files that changed from the base of the PR and between 51e34d5 and 661fa5f.

📒 Files selected for processing (1)
  • .github/workflows/agent-fix.yml

Comment on lines 71 to 89
commentBody = `Hello @${issuee},

I have successfully fixed the issue! 🎉
I have successfully fixed the issue! 🎉

A Pull Request has been created with the changes:
🔗 **[Pull Request](${prUrl})**
A Pull Request has been created with the changes:
🔗 **[Pull Request](${prUrl})**

**Run ID:** \`${runId}\`
**Message:** ${message}`;
**Run ID:** \`${runId}\`
**Message:** ${message}`;
} else {
commentBody = `Hello @${issuee},

I attempted to fix this issue automatically but encountered a problem.
I attempted to fix this issue automatically but encountered a problem.

**Outcome:** \`${outcome || 'unknown/failed'}\`
**Message:** ${message || 'No additional message was provided.'}
**Outcome:** \`${outcome || 'unknown/failed'}\`
**Message:** ${message || 'No additional message was provided.'}

Please check the GitHub Actions workflow logs for more details.`;
Please check the GitHub Actions workflow logs for more details.`;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Avoid leaking YAML indentation into the posted comments.

The spaces required to indent the YAML block scalar are preserved inside these template literals. Consequently, the generated comment’s body lines become an indented Markdown code block, so the PR link and bold fields will render incorrectly. Build each body from an array joined with "\n" (or apply a safe dedent helper) so the YAML indentation does not become comment content.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/agent-fix.yml around lines 71 - 89, Update the success and
failure comment-body construction in the workflow to avoid preserving YAML
indentation in posted Markdown. Build each message from unindented line strings
joined with "\n" (or use an existing safe dedent helper), while preserving the
current interpolated values, formatting, and fallback messages.

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