Skip to content

Commit fd9bbee

Browse files
committed
tw-description updated with checklists (beta)
1 parent 1758d46 commit fd9bbee

1 file changed

Lines changed: 48 additions & 29 deletions

File tree

commands/host/tw-description

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -90,42 +90,61 @@ if [ -z "$MR_LINK" ]; then
9090
exit 1
9191
fi
9292

93-
# Prompt for deploy state/notes (multiline)
94-
echo_yellow "Enter deploy state (empty line to finish, or press Enter for 'Pending'):"
95-
DEPLOY_STATE=""
96-
while IFS= read -e -r line; do
97-
if [ -z "$line" ]; then
98-
if [ -z "$DEPLOY_STATE" ]; then
99-
DEPLOY_STATE="Pending"
100-
fi
101-
break
102-
fi
103-
if [ -n "$DEPLOY_STATE" ]; then
104-
DEPLOY_STATE="${DEPLOY_STATE}
105-
${line}"
106-
else
107-
DEPLOY_STATE="$line"
108-
fi
93+
# Prompt for deploy state/notes - pre-fill default checklist items for inline editing
94+
echo_yellow "Edit deploy checklist (arrow keys to edit, clear a line to remove it, empty line to finish):"
95+
DEPLOY_ITEMS=()
96+
for default_item in "* [ ] Merge Dev" "* [ ] Merge Production"; do
97+
read -e -i "$default_item" -r line
98+
[ -n "$line" ] && DEPLOY_ITEMS+=("$line")
99+
done
100+
echo_yellow "Add more items (empty line to finish):"
101+
while IFS= read -r line; do
102+
[ -z "$line" ] && break
103+
DEPLOY_ITEMS+=("$line")
109104
done
105+
DEPLOY_STATE=$(printf '%s\n' "${DEPLOY_ITEMS[@]}")
110106

111107
# Prompt for test notes (multiline)
112-
echo_yellow "Enter test notes/plan (empty line to finish):"
113108
TEST_NOTES=""
114-
while IFS= read -e -r line; do
115-
if [ -z "$line" ] && [ -n "$TEST_NOTES" ]; then
116-
break
117-
fi
118-
if [ -n "$TEST_NOTES" ]; then
119-
TEST_NOTES="${TEST_NOTES}
109+
while [ -z "$TEST_NOTES" ]; do
110+
echo_yellow "Enter test notes/plan (empty line to finish):"
111+
while IFS= read -r line; do
112+
if [ -z "$line" ]; then
113+
break
114+
fi
115+
if [ -n "$TEST_NOTES" ]; then
116+
TEST_NOTES="${TEST_NOTES}
120117
${line}"
121-
else
122-
TEST_NOTES="$line"
118+
else
119+
TEST_NOTES="$line"
120+
fi
121+
done
122+
if [ -z "$TEST_NOTES" ]; then
123+
echo_red "Test notes are required, please enter at least one line."
123124
fi
124125
done
125126

126-
if [ -z "$TEST_NOTES" ]; then
127-
echo_red "Error: Test notes are required"
128-
exit 1
127+
# Fetch Dev URL if upstream provider is platform or upsun
128+
UPSUN_DEV_URL=""
129+
ENV_FILE=".ddev/.env.anner"
130+
if [ -f "$ENV_FILE" ]; then
131+
DEV_UPSTREAM_PROVIDER=$(grep -E '^DEV_UPSTREAM_PROVIDER=' "$ENV_FILE" | cut -d= -f2 | tr -d '"' | tr -d "'" || true)
132+
if [[ "$DEV_UPSTREAM_PROVIDER" == "platform" || "$DEV_UPSTREAM_PROVIDER" == "upsun" ]]; then
133+
read -e -r -p "$(echo -e "${YELLOW}Include Dev environment URL in test notes? [Y/n]: ${NC}")" include_url
134+
include_url="${include_url:-Y}"
135+
if [[ "$include_url" =~ ^[Yy]$ ]]; then
136+
echo_yellow "Fetching Dev environment URL..."
137+
UPSUN_DEV_URL=$(ddev exec upsun url -1 -e dev 2>/dev/null || echo "")
138+
if [ -n "$UPSUN_DEV_URL" ]; then
139+
echo_green "Found Dev URL: ${UPSUN_DEV_URL}"
140+
TEST_NOTES="Dev URL: ${UPSUN_DEV_URL}
141+
142+
${TEST_NOTES}"
143+
else
144+
echo_yellow "No Dev URL found, skipping."
145+
fi
146+
fi
147+
fi
129148
fi
130149

131150
# Get existing task description
@@ -166,7 +185,7 @@ else
166185
fi
167186

168187
# Build new section to append
169-
NEW_SECTION="## Deploy
188+
NEW_SECTION="## Deployment
170189
171190
- MR: ${MR_LINK}
172191
- Branch: \`${branch_name}\`

0 commit comments

Comments
 (0)