Skip to content

GitHub CLI with complex markdown body #40

@konard

Description

@konard

🐛 Bug Description

GitHub CLI commands fail when trying to pass complex markdown content through the --body parameter due to shell escaping issues with backticks, quotes, and special characters.

🔴 Impact

  • Can't create GitHub issues/PRs with code examples programmatically
  • Markdown documentation can't be passed through CLI
  • CI/CD workflows that create issues fail with complex content

📝 Problem Details

When using `gh issue create --body` with markdown containing:

  • Code blocks with triple backticks
  • Inline code with single backticks
  • Dollar signs with variables (${var})
  • Mixed quotes types
  • Multi-line content

The shell interprets these special characters causing command failure.

🔧 Workaround

Use `--body-file` parameter instead:
```javascript
// Write content to temp file first
await fs.writeFile(tempFile, markdownContent);
// Use --body-file instead of --body
await $`gh issue create --body-file ${tempFile}`;
```

🔗 References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions