@@ -29,28 +29,20 @@ echo '::endgroup::'
2929
3030ISSUE_NUMBER=$( gh issue list --repo " ${REPO} " --state " ${STATE} " --label " ${LABELS} " --search " in:title \" ${TITLE} \" " --limit 1 --json number --jq ' .[].number' || true)
3131
32- # Perform action based on mode
3332case " ${MODE} " in
3433create)
35- # Determine body args
36- if [ -n " ${BODY} " ]; then
37- BODY_ARGS=" \" ${BODY} \" "
38- else
39- BODY_ARGS=" \" Auto-generated issue with title: ${TITLE} \" "
40- fi
41-
4234 if [ -n " ${ISSUE_NUMBER} " ]; then
4335 echo " Issue already exists (#${ISSUE_NUMBER} ), updating instead."
4436 if [ -n " ${COMMENT} " ]; then
4537 echo " Adding comment to existing issue..."
46- gh issue comment " ${ISSUE_NUMBER} " --repo " ${REPO} " --body " ${COMMENT} "
38+ gh issue comment " ${ISSUE_NUMBER} " --repo " ${REPO} " --body " ${COMMENT} " --edit-last --create-if-none --yes
4739 else
4840 echo " Updating issue body..."
49- gh issue edit " ${ISSUE_NUMBER} " --repo " ${REPO} " --title " ${TITLE} " --body " ${BODY_ARGS } "
41+ gh issue edit " ${ISSUE_NUMBER} " --repo " ${REPO} " --title " ${TITLE} " --body " ${BODY } "
5042 fi
5143 else
5244 echo " Creating new issue..."
53- gh issue create --repo " ${REPO} " --title " ${TITLE} " --body " ${BODY_ARGS } " --label " ${LABELS} " --assignee " ${ASSIGNEES} "
45+ gh issue create --repo " ${REPO} " --title " ${TITLE} " --body " ${BODY } " --label " ${LABELS} " --assignee " ${ASSIGNEES} "
5446 fi
5547 ;;
5648close)
@@ -59,11 +51,12 @@ close)
5951 exit 0
6052 fi
6153 if [ -n " ${COMMENT} " ]; then
62- echo " Adding closure comment..."
63- gh issue comment " ${ISSUE_NUMBER} " --repo " ${REPO} " --body " ${COMMENT} "
54+ echo " Closing issue #${ISSUE_NUMBER} with comment..."
55+ gh issue close " ${ISSUE_NUMBER} " --repo " ${REPO} " --comment " ${COMMENT} "
56+ else
57+ echo " Closing issue #${ISSUE_NUMBER} ..."
58+ gh issue close " ${ISSUE_NUMBER} " --repo " ${REPO} "
6459 fi
65- echo " Closing issue #${ISSUE_NUMBER} ..."
66- gh issue close " ${ISSUE_NUMBER} " --repo " ${REPO} "
6760 ;;
6861* )
6962 echo " Invalid mode '${MODE} '. Valid options: create | close"
0 commit comments