Compare commits

..

1 Commits

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

View File

@@ -112,21 +112,22 @@ 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="$CMD --body \"$BODY\"" [[ -n "$BODY" ]] && CMD+=(--body "$BODY")
[[ -n "$LABELS" ]] && CMD="$CMD --label \"$LABELS\"" [[ -n "$LABELS" ]] && CMD+=(--label "$LABELS")
[[ -n "$MILESTONE" ]] && CMD="$CMD --milestone \"$MILESTONE\"" [[ -n "$MILESTONE" ]] && CMD+=(--milestone "$MILESTONE")
eval "$CMD" "${CMD[@]}"
;; ;;
gitea) gitea)
if command -v tea >/dev/null 2>&1; then if command -v tea >/dev/null 2>&1; then
REPO_ARGS=$(get_gitea_repo_args) REPO_SLUG=$(get_repo_slug)
CMD="tea issue create $REPO_ARGS --title \"$TITLE\"" REPO_ARGS=(--repo "$REPO_SLUG" --login "${GITEA_LOGIN:-mosaicstack}")
[[ -n "$BODY" ]] && CMD="$CMD --description \"$BODY\"" CMD=(tea issue create "${REPO_ARGS[@]}" --title "$TITLE")
[[ -n "$LABELS" ]] && CMD="$CMD --labels \"$LABELS\"" [[ -n "$BODY" ]] && CMD+=(--description "$BODY")
[[ -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="$CMD --milestone \"$MILESTONE\"" [[ -n "$MILESTONE" ]] && CMD+=(--milestone "$MILESTONE")
if eval "$CMD"; then if "${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,35 +163,37 @@ 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="$CMD --body \"$BODY\"" [[ -n "$BODY" ]] && CMD+=(--body "$BODY")
[[ -n "$BASE_BRANCH" ]] && CMD="$CMD --base \"$BASE_BRANCH\"" [[ -n "$BASE_BRANCH" ]] && CMD+=(--base "$BASE_BRANCH")
[[ -n "$HEAD_BRANCH" ]] && CMD="$CMD --head \"$HEAD_BRANCH\"" [[ -n "$HEAD_BRANCH" ]] && CMD+=(--head "$HEAD_BRANCH")
[[ -n "$LABELS" ]] && CMD="$CMD --label \"$LABELS\"" [[ -n "$LABELS" ]] && CMD+=(--label "$LABELS")
[[ -n "$MILESTONE" ]] && CMD="$CMD --milestone \"$MILESTONE\"" [[ -n "$MILESTONE" ]] && CMD+=(--milestone "$MILESTONE")
[[ "$DRAFT" == true ]] && CMD="$CMD --draft" [[ "$DRAFT" == true ]] && CMD+=(--draft)
eval "$CMD" "${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. # is unreliable in Mosaic worktrees/profile shells. Use arrays instead
REPO_ARGS=$(get_gitea_repo_args) # of eval so markdown backticks/body content are not shell-executed.
CMD="tea pr create $REPO_ARGS --title \"$TITLE\"" REPO_SLUG=$(get_repo_slug)
[[ -n "$BODY" ]] && CMD="$CMD --description \"$BODY\"" REPO_ARGS=(--repo "$REPO_SLUG" --login "${GITEA_LOGIN:-mosaicstack}")
[[ -n "$BASE_BRANCH" ]] && CMD="$CMD --base \"$BASE_BRANCH\"" CMD=(tea pr create "${REPO_ARGS[@]}" --title "$TITLE")
[[ -n "$HEAD_BRANCH" ]] && CMD="$CMD --head \"$HEAD_BRANCH\"" [[ -n "$BODY" ]] && CMD+=(--description "$BODY")
[[ -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="$CMD --labels \"$LABELS\"" 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="$CMD --milestone $MILESTONE_ID" 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
@@ -202,7 +204,11 @@ 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
eval "$CMD" if "${CMD[@]}"; then
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