Skip to content

Fix YAML syntax errors in BIDS validation workflow template - #286

Merged
neuromechanist merged 2 commits into
devfrom
fix/issue-285-yaml-escape
Mar 14, 2026
Merged

neuromechanist merged 2 commits into
devfrom
fix/issue-285-yaml-escape

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • Fix escaped newlines (\n) in BIDS validation workflow template that broke YAML syntax
  • In JS template literals, \n becomes a literal newline character, not the two-character sequence \n
  • This caused YAML parse errors on line 33 (find -printf format) and line 51 (jq split argument)

Root Cause

PR #271 added annex pointer filtering to the BIDS validation workflow template. Two shell commands use \n:

  1. find -printf '/%P\n' - newline separator in output
  2. jq split("\n") - split on newline

Inside a JavaScript template literal (backtick string), \n is interpreted as a real newline character. The deployed YAML ended up with literal newlines mid-line, breaking block scalar indentation rules.

Fix

Escape as \\n (double backslash) so the template produces the literal two-character sequence \n in the output YAML.

Affected Repos

3 repos have the broken workflow deployed and need redeployment after this fix:

  • nm000130
  • nm000131
  • on003825

Test plan

  • Verified with bun -e that \\n in template literal produces literal \n string
  • Deploy fix and redeploy workflows to affected repos via nemar admin ci add

Fixes #285

In JS template literals, \n is interpreted as a literal newline
character, not the two-character sequence \n. This broke the
deployed YAML on line 33 (find -printf format) and line 51
(jq split argument) by inserting real newlines mid-line,
violating YAML block scalar indentation rules.

Fix: escape as \\n to produce literal \n in the output.

Affected repos: nm000130, nm000131, on003825.

Fixes #285
@github-actions

github-actions Bot commented Mar 14, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR286

Version: 0.7.17-PR286.95e0470
Commit: 95e0470


🤖 Updated on each push.

- Extract getWorkflowTemplates() for testability
- Add YAML validation test (prevents #285 regression)
- Fix createOrUpdateFile: handle non-OK GET responses,
  wrap fetch errors with context
- Fix empty catch in resolveAnnexKey template
- Remove hardcoded WORKFLOW_FILES; use deployWorkflows
  return data for accurate deployed/failed counts
- Include specific errors in finalize warnings
@neuromechanist
neuromechanist merged commit 581f7a3 into dev Mar 14, 2026
8 checks passed
This was referenced Mar 14, 2026
@neuromechanist
neuromechanist deleted the fix/issue-285-yaml-escape branch April 28, 2026 01:23

This branch was previously deployed

1 inactive deployment
npm — 95e04702 Deployed Mar 14, 2026 by neuromechanist via publish #486
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.

1 participant