Skip to content

Commit cc4ed6c

Browse files
committed
Fix shell quoting issues in Confluence page creation step
- Write requirement data to JSON file in first step using jq - Read from JSON file in second step to avoid shell substitution issues - Add safety check to ensure TITLE is never empty - Fixes 'Admin to SlackONOS: command not found' errors - Fixes HTTP 400 'You must specify a title' error
1 parent 49672c0 commit cc4ed6c

1 file changed

Lines changed: 45 additions & 7 deletions

File tree

.github/workflows/confluence-requirements.yml

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,27 @@ jobs:
4646
4747
TITLE="${DATE_STR} ${SUMMARY}"
4848
49-
echo "title=$TITLE" >> $GITHUB_OUTPUT
49+
# Write all data to JSON file to avoid shell quoting issues
50+
jq -n \
51+
--arg title "$TITLE" \
52+
--arg enhanced_task "$ENHANCED_TASK" \
53+
--arg original_task "$ORIGINAL_TASK" \
54+
--arg requester "$REQUESTER" \
55+
--arg timestamp "$TIMESTAMP" \
56+
--arg preprocessing_run_id "$PREPROCESSING_RUN_ID" \
57+
'{
58+
title: $title,
59+
enhanced_task: $enhanced_task,
60+
original_task: $original_task,
61+
requester: $requester,
62+
timestamp: $timestamp,
63+
preprocessing_run_id: $preprocessing_run_id
64+
}' > /tmp/requirement_data.json
65+
66+
# Also set outputs for backward compatibility (using EOF for multiline values)
67+
echo "title<<EOF" >> $GITHUB_OUTPUT
68+
echo "$TITLE" >> $GITHUB_OUTPUT
69+
echo "EOF" >> $GITHUB_OUTPUT
5070
echo "enhanced_task<<EOF" >> $GITHUB_OUTPUT
5171
echo "$ENHANCED_TASK" >> $GITHUB_OUTPUT
5272
echo "EOF" >> $GITHUB_OUTPUT
@@ -68,12 +88,30 @@ jobs:
6888
run: |
6989
set -o pipefail
7090
71-
TITLE="${{ steps.requirement.outputs.title }}"
72-
ENHANCED_TASK="${{ steps.requirement.outputs.enhanced_task }}"
73-
ORIGINAL_TASK="${{ steps.requirement.outputs.original_task }}"
74-
REQUESTER="${{ steps.requirement.outputs.requester }}"
75-
TIMESTAMP="${{ steps.requirement.outputs.timestamp }}"
76-
PREPROCESSING_RUN_ID="${{ steps.requirement.outputs.preprocessing_run_id }}"
91+
# Read all values from JSON file to avoid shell quoting issues
92+
if [ -f /tmp/requirement_data.json ] && jq -e . /tmp/requirement_data.json >/dev/null 2>&1; then
93+
# Read from JSON file (safest method)
94+
TITLE=$(jq -r '.title // ""' /tmp/requirement_data.json)
95+
ENHANCED_TASK=$(jq -r '.enhanced_task // ""' /tmp/requirement_data.json)
96+
ORIGINAL_TASK=$(jq -r '.original_task // ""' /tmp/requirement_data.json)
97+
REQUESTER=$(jq -r '.requester // ""' /tmp/requirement_data.json)
98+
TIMESTAMP=$(jq -r '.timestamp // ""' /tmp/requirement_data.json)
99+
PREPROCESSING_RUN_ID=$(jq -r '.preprocessing_run_id // ""' /tmp/requirement_data.json)
100+
else
101+
# Fallback to outputs (may have quoting issues but better than nothing)
102+
TITLE="${{ steps.requirement.outputs.title }}"
103+
ENHANCED_TASK="${{ steps.requirement.outputs.enhanced_task }}"
104+
ORIGINAL_TASK="${{ steps.requirement.outputs.original_task }}"
105+
REQUESTER="${{ steps.requirement.outputs.requester }}"
106+
TIMESTAMP="${{ steps.requirement.outputs.timestamp }}"
107+
PREPROCESSING_RUN_ID="${{ steps.requirement.outputs.preprocessing_run_id }}"
108+
fi
109+
110+
# Ensure TITLE is not empty
111+
if [ -z "$TITLE" ]; then
112+
DATE_STR=$(date +%Y-%m-%d)
113+
TITLE="${DATE_STR} Task"
114+
fi
77115
78116
# Convert enhanced task (user story) to Confluence storage format
79117
# Convert markdown-like formatting to HTML

0 commit comments

Comments
 (0)