Compare commits

..

1 Commits

Author SHA1 Message Date
Jarvis
abbd889e30 fix(mosaic-tools): pass explicit Gitea repo args
Some checks failed
ci/woodpecker/push/ci Pipeline was canceled
ci/woodpecker/pr/ci Pipeline was canceled
2026-05-26 14:29:42 -05:00
2 changed files with 29 additions and 36 deletions

View File

@@ -112,22 +112,21 @@ PLATFORM=$(detect_platform)
case "$PLATFORM" in case "$PLATFORM" in
github) github)
CMD=(gh issue create --title "$TITLE") CMD="gh issue create --title \"$TITLE\""
[[ -n "$BODY" ]] && CMD+=(--body "$BODY") [[ -n "$BODY" ]] && CMD="$CMD --body \"$BODY\""
[[ -n "$LABELS" ]] && CMD+=(--label "$LABELS") [[ -n "$LABELS" ]] && CMD="$CMD --label \"$LABELS\""
[[ -n "$MILESTONE" ]] && CMD+=(--milestone "$MILESTONE") [[ -n "$MILESTONE" ]] && CMD="$CMD --milestone \"$MILESTONE\""
"${CMD[@]}" eval "$CMD"
;; ;;
gitea) gitea)
if command -v tea >/dev/null 2>&1; then if command -v tea >/dev/null 2>&1; then
REPO_SLUG=$(get_repo_slug) REPO_ARGS=$(get_gitea_repo_args)
REPO_ARGS=(--repo "$REPO_SLUG" --login "${GITEA_LOGIN:-mosaicstack}") CMD="tea issue create $REPO_ARGS --title \"$TITLE\""
CMD=(tea issue create "${REPO_ARGS[@]}" --title "$TITLE") [[ -n "$BODY" ]] && CMD="$CMD --description \"$BODY\""
[[ -n "$BODY" ]] && CMD+=(--description "$BODY") [[ -n "$LABELS" ]] && CMD="$CMD --labels \"$LABELS\""
[[ -n "$LABELS" ]] && CMD+=(--labels "$LABELS")
# tea accepts milestone by name directly (verified 2026-02-05) # tea accepts milestone by name directly (verified 2026-02-05)
[[ -n "$MILESTONE" ]] && CMD+=(--milestone "$MILESTONE") [[ -n "$MILESTONE" ]] && CMD="$CMD --milestone \"$MILESTONE\""
if "${CMD[@]}"; then if eval "$CMD"; then
exit 0 exit 0
fi fi
echo "Warning: tea issue create failed, trying Gitea API fallback..." >&2 echo "Warning: tea issue create failed, trying Gitea API fallback..." >&2

View File

@@ -163,37 +163,35 @@ PLATFORM=$(detect_platform)
case "$PLATFORM" in case "$PLATFORM" in
github) github)
CMD=(gh pr create --title "$TITLE") CMD="gh pr create --title \"$TITLE\""
[[ -n "$BODY" ]] && CMD+=(--body "$BODY") [[ -n "$BODY" ]] && CMD="$CMD --body \"$BODY\""
[[ -n "$BASE_BRANCH" ]] && CMD+=(--base "$BASE_BRANCH") [[ -n "$BASE_BRANCH" ]] && CMD="$CMD --base \"$BASE_BRANCH\""
[[ -n "$HEAD_BRANCH" ]] && CMD+=(--head "$HEAD_BRANCH") [[ -n "$HEAD_BRANCH" ]] && CMD="$CMD --head \"$HEAD_BRANCH\""
[[ -n "$LABELS" ]] && CMD+=(--label "$LABELS") [[ -n "$LABELS" ]] && CMD="$CMD --label \"$LABELS\""
[[ -n "$MILESTONE" ]] && CMD+=(--milestone "$MILESTONE") [[ -n "$MILESTONE" ]] && CMD="$CMD --milestone \"$MILESTONE\""
[[ "$DRAFT" == true ]] && CMD+=(--draft) [[ "$DRAFT" == true ]] && CMD="$CMD --draft"
"${CMD[@]}" eval "$CMD"
;; ;;
gitea) gitea)
# tea pull create syntax. Always pass --repo because tea repo inference # tea pull create syntax. Always pass --repo because tea repo inference
# is unreliable in Mosaic worktrees/profile shells. Use arrays instead # is unreliable in Mosaic worktrees/profile shells.
# of eval so markdown backticks/body content are not shell-executed. REPO_ARGS=$(get_gitea_repo_args)
REPO_SLUG=$(get_repo_slug) CMD="tea pr create $REPO_ARGS --title \"$TITLE\""
REPO_ARGS=(--repo "$REPO_SLUG" --login "${GITEA_LOGIN:-mosaicstack}") [[ -n "$BODY" ]] && CMD="$CMD --description \"$BODY\""
CMD=(tea pr create "${REPO_ARGS[@]}" --title "$TITLE") [[ -n "$BASE_BRANCH" ]] && CMD="$CMD --base \"$BASE_BRANCH\""
[[ -n "$BODY" ]] && CMD+=(--description "$BODY") [[ -n "$HEAD_BRANCH" ]] && CMD="$CMD --head \"$HEAD_BRANCH\""
[[ -n "$BASE_BRANCH" ]] && CMD+=(--base "$BASE_BRANCH")
[[ -n "$HEAD_BRANCH" ]] && CMD+=(--head "$HEAD_BRANCH")
# Handle labels for tea # Handle labels for tea
if [[ -n "$LABELS" ]]; then if [[ -n "$LABELS" ]]; then
# tea may use --labels flag # tea may use --labels flag
CMD+=(--labels "$LABELS") CMD="$CMD --labels \"$LABELS\""
fi fi
# Handle milestone for tea # Handle milestone for tea
if [[ -n "$MILESTONE" ]]; then if [[ -n "$MILESTONE" ]]; then
MILESTONE_ID=$(tea milestones list "${REPO_ARGS[@]}" 2>/dev/null | grep -E "^\s*[0-9]+" | grep "$MILESTONE" | awk '{print $1}' | head -1) MILESTONE_ID=$(tea milestones list $REPO_ARGS 2>/dev/null | grep -E "^\s*[0-9]+" | grep "$MILESTONE" | awk '{print $1}' | head -1)
if [[ -n "$MILESTONE_ID" ]]; then if [[ -n "$MILESTONE_ID" ]]; then
CMD+=(--milestone "$MILESTONE_ID") CMD="$CMD --milestone $MILESTONE_ID"
else else
echo "Warning: Could not find milestone '$MILESTONE', creating without milestone" >&2 echo "Warning: Could not find milestone '$MILESTONE', creating without milestone" >&2
fi fi
@@ -204,11 +202,7 @@ case "$PLATFORM" in
echo "Note: Draft PR may not be supported by your tea version" >&2 echo "Note: Draft PR may not be supported by your tea version" >&2
fi fi
if "${CMD[@]}"; then eval "$CMD"
exit 0
fi
echo "Warning: tea pr create failed, trying Gitea API fallback..." >&2
gitea_pr_create_api
;; ;;
*) *)
echo "Error: Could not detect git platform" >&2 echo "Error: Could not detect git platform" >&2