Skip to content

Instantly share code, notes, and snippets.

@fizz
Created March 2, 2026 05:57
Show Gist options
  • Select an option

  • Save fizz/57a6e1a18475259b169ebc21259fd49e to your computer and use it in GitHub Desktop.

Select an option

Save fizz/57a6e1a18475259b169ebc21259fd49e to your computer and use it in GitHub Desktop.
jira-comment — pipe-safe comment wrapper for go-jira. Accepts body via stdin, no shell escaping needed.
#!/usr/bin/env bash
# jira-comment — pipe-safe comment wrapper for go-jira
#
# Accepts comment body via stdin so you never need to shell-escape
# quotes, backticks, URLs, or Atlassian [~accountid:] mentions.
#
# Usage:
# echo "looks good, merging" | jira-comment NA-393
# jira-comment NA-393 <<'EOF'
# Multi-line comment with "quotes" and `backticks`
# and [~accountid:abc123] mentions
# EOF
#
# Requires: go-jira (https://github.com/go-jira/jira)
set -euo pipefail
ticket="${1:?Usage: jira-comment TICKET <<< 'comment body'}"
body="$(cat)"
[[ -z "$body" ]] && { echo "Error: empty comment body" >&2; exit 1; }
exec jira comment "$ticket" --noedit -m "$body"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment