#!/bin/bash # issue-create.sh - Create issues on Gitea or GitHub # Usage: issue-create.sh -t "Title" [-b "Body"] [-l "label1,label2"] [-m "milestone"] set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/detect-platform.sh" # Default values TITLE="" BODY="" LABELS="" MILESTONE="" usage() { cat <&2 usage ;; esac done if [[ -z "$TITLE" ]]; then echo "Error: Title is required (-t)" >&2 usage fi PLATFORM=$(detect_platform) case "$PLATFORM" in github) CMD="gh issue create --title \"$TITLE\"" [[ -n "$BODY" ]] && CMD="$CMD --body \"$BODY\"" [[ -n "$LABELS" ]] && CMD="$CMD --label \"$LABELS\"" [[ -n "$MILESTONE" ]] && CMD="$CMD --milestone \"$MILESTONE\"" eval "$CMD" ;; gitea) CMD="tea issue create --title \"$TITLE\"" [[ -n "$BODY" ]] && CMD="$CMD --description \"$BODY\"" [[ -n "$LABELS" ]] && CMD="$CMD --labels \"$LABELS\"" # tea accepts milestone by name directly (verified 2026-02-05) [[ -n "$MILESTONE" ]] && CMD="$CMD --milestone \"$MILESTONE\"" eval "$CMD" ;; *) echo "Error: Could not detect git platform" >&2 exit 1 ;; esac