Skip to content

Commit 49092a6

Browse files
committed
feat: add warning if there are no sub-issues/parents found
1 parent 8281e69 commit 49092a6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

gh-cli/get-parent-issue-of-issue.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ issue_number="$3"
1414

1515
# Define color codes
1616
RED='\033[0;31m'
17+
YELLOW='\033[0;33m'
1718
NC='\033[0m' # No Color
1819

1920
# Fetch the issue ID given the issue number
@@ -68,3 +69,9 @@ formatted_parent_issue=$(echo "$parent_issue" | jq -r '
6869

6970
# Print the formatted parent issue details
7071
echo "$formatted_parent_issue" | jq .
72+
73+
# Check if parent issue is null and print a warning
74+
number=$(echo "$formatted_parent_issue" | jq -r '.number')
75+
if [ "$number" = "null" ]; then
76+
echo -e "${YELLOW}Warning: No parent issue for $org/$repo#$issue_number.${NC}"
77+
fi

gh-cli/get-sub-issues-of-issue.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ issue_number="$3"
1414

1515
# Define color codes
1616
RED='\033[0;31m'
17+
YELLOW='\033[0;33m'
1718
NC='\033[0m' # No Color
1819

1920
# Fetch the issue ID given the issue number
@@ -72,3 +73,9 @@ combined_result=$(echo "$sub_issues" | jq -s '
7273

7374
# Print the combined result as a colorized JSON object
7475
echo "$combined_result" | jq .
76+
77+
# Check if total is 0 and print a warning
78+
total=$(echo "$combined_result" | jq -r '.totalCount')
79+
if [ "$total" -eq 0 ]; then
80+
echo -e "${YELLOW}Warning: The total number of sub-issues for $org/$repo#$issue_number is 0.${NC}"
81+
fi

0 commit comments

Comments
 (0)