Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Commit d3c93da

Browse files
committed
Fix special character handling in workflow scripts
1 parent e9ffeb2 commit d3c93da

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

.github/workflows/claude-full.yml

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,18 @@ jobs:
4848
id: issue
4949
run: |
5050
ISSUE_NUMBER="${{ github.event.issue.number }}"
51-
FEEDBACK="${{ github.event.comment.body }}"
51+
# Use single quotes to prevent Bash from interpreting special characters
52+
FEEDBACK='${{ github.event.comment.body }}'
5253
COMMENT_AUTHOR="${{ github.event.comment.user.login }}"
5354
# Remove the "claude:" prefix
5455
FEEDBACK="${FEEDBACK#claude:}"
5556
# Remove newlines from feedback to prevent GitHub Actions output issues
5657
FEEDBACK_CLEANED="$(echo "$FEEDBACK" | tr '\n' ' ')"
5758
echo "number=${ISSUE_NUMBER}" >> $GITHUB_OUTPUT
58-
echo "feedback=${FEEDBACK_CLEANED}" >> $GITHUB_OUTPUT
59+
# Use EOF to properly handle special characters in GITHUB_OUTPUT
60+
echo "feedback<<EOF" >> $GITHUB_OUTPUT
61+
echo "$FEEDBACK_CLEANED" >> $GITHUB_OUTPUT
62+
echo "EOF" >> $GITHUB_OUTPUT
5963
echo "comment_author=${COMMENT_AUTHOR}" >> $GITHUB_OUTPUT
6064
6165
- name: Process with Claude Code for issue analysis
@@ -107,14 +111,18 @@ jobs:
107111
id: issue
108112
run: |
109113
ISSUE_NUMBER="${{ github.event.issue.number }}"
110-
FEEDBACK="${{ github.event.comment.body }}"
114+
# Use single quotes to prevent Bash from interpreting special characters
115+
FEEDBACK='${{ github.event.comment.body }}'
111116
COMMENT_AUTHOR="${{ github.event.comment.user.login }}"
112117
# Remove the "claude-fix:" prefix
113118
FEEDBACK="${FEEDBACK#claude-fix:}"
114119
# Remove newlines from feedback to prevent GitHub Actions output issues
115120
FEEDBACK_CLEANED="$(echo "$FEEDBACK" | tr '\n' ' ')"
116121
echo "number=${ISSUE_NUMBER}" >> $GITHUB_OUTPUT
117-
echo "feedback=${FEEDBACK_CLEANED}" >> $GITHUB_OUTPUT
122+
# Use EOF to properly handle special characters in GITHUB_OUTPUT
123+
echo "feedback<<EOF" >> $GITHUB_OUTPUT
124+
echo "$FEEDBACK_CLEANED" >> $GITHUB_OUTPUT
125+
echo "EOF" >> $GITHUB_OUTPUT
118126
echo "comment_author=${COMMENT_AUTHOR}" >> $GITHUB_OUTPUT
119127
120128
- name: Process with Claude Code for issue fix
@@ -158,13 +166,17 @@ jobs:
158166
id: pr
159167
run: |
160168
PR_NUMBER="${{ github.event.issue.number }}"
161-
FEEDBACK="${{ github.event.comment.body }}"
169+
# Use single quotes to prevent Bash from interpreting special characters
170+
FEEDBACK='${{ github.event.comment.body }}'
162171
# Remove the "claude:" prefix
163172
FEEDBACK="${FEEDBACK#claude:}"
164173
# Remove newlines from feedback to prevent GitHub Actions output issues
165174
FEEDBACK_CLEANED="$(echo "$FEEDBACK" | tr '\n' ' ')"
166175
echo "number=${PR_NUMBER}" >> $GITHUB_OUTPUT
167-
echo "feedback=${FEEDBACK_CLEANED}" >> $GITHUB_OUTPUT
176+
# Use EOF to properly handle special characters in GITHUB_OUTPUT
177+
echo "feedback<<EOF" >> $GITHUB_OUTPUT
178+
echo "$FEEDBACK_CLEANED" >> $GITHUB_OUTPUT
179+
echo "EOF" >> $GITHUB_OUTPUT
168180
169181
- name: Process with Claude Code
170182
uses: basicmachines-co/[email protected]
@@ -193,13 +205,17 @@ jobs:
193205
id: pr
194206
run: |
195207
PR_NUMBER="${{ github.event.issue.number }}"
196-
FEEDBACK="${{ github.event.comment.body }}"
208+
# Use single quotes to prevent Bash from interpreting special characters
209+
FEEDBACK='${{ github.event.comment.body }}'
197210
# Remove the "claude-suggest:" prefix
198211
FEEDBACK="${FEEDBACK#claude-suggest:}"
199212
# Remove newlines from feedback to prevent GitHub Actions output issues
200213
FEEDBACK_CLEANED="$(echo "$FEEDBACK" | tr '\n' ' ')"
201214
echo "number=${PR_NUMBER}" >> $GITHUB_OUTPUT
202-
echo "feedback=${FEEDBACK_CLEANED}" >> $GITHUB_OUTPUT
215+
# Use EOF to properly handle special characters in GITHUB_OUTPUT
216+
echo "feedback<<EOF" >> $GITHUB_OUTPUT
217+
echo "$FEEDBACK_CLEANED" >> $GITHUB_OUTPUT
218+
echo "EOF" >> $GITHUB_OUTPUT
203219
204220
- name: Process with Claude Code Suggestions
205221
uses: basicmachines-co/[email protected]
@@ -230,7 +246,8 @@ jobs:
230246
id: details
231247
run: |
232248
PR_NUMBER="${{ github.event.pull_request.number }}"
233-
FEEDBACK="${{ github.event.comment.body }}"
249+
# Use single quotes to prevent Bash from interpreting special characters
250+
FEEDBACK='${{ github.event.comment.body }}'
234251
# Remove the "claude:" prefix
235252
FEEDBACK="${FEEDBACK#claude:}"
236253
COMMENT_ID="${{ github.event.comment.id }}"
@@ -240,7 +257,10 @@ jobs:
240257
# Remove newlines from feedback to prevent GitHub Actions output issues
241258
FEEDBACK_CLEANED="$(echo "$FEEDBACK" | tr '\n' ' ')"
242259
echo "number=${PR_NUMBER}" >> $GITHUB_OUTPUT
243-
echo "feedback=${FEEDBACK_CLEANED}" >> $GITHUB_OUTPUT
260+
# Use EOF to properly handle special characters in GITHUB_OUTPUT
261+
echo "feedback<<EOF" >> $GITHUB_OUTPUT
262+
echo "$FEEDBACK_CLEANED" >> $GITHUB_OUTPUT
263+
echo "EOF" >> $GITHUB_OUTPUT
244264
245265
echo "comment_id=${COMMENT_ID}" >> $GITHUB_OUTPUT
246266
echo "file_path=${FILE_PATH}" >> $GITHUB_OUTPUT
@@ -273,7 +293,8 @@ jobs:
273293
id: details
274294
run: |
275295
PR_NUMBER="${{ github.event.pull_request.number }}"
276-
FEEDBACK="${{ github.event.comment.body }}"
296+
# Use single quotes to prevent Bash from interpreting special characters
297+
FEEDBACK='${{ github.event.comment.body }}'
277298
# Remove the "claude-suggest:" prefix
278299
FEEDBACK="${FEEDBACK#claude-suggest:}"
279300
COMMENT_ID="${{ github.event.comment.id }}"
@@ -283,7 +304,10 @@ jobs:
283304
# Remove newlines from feedback to prevent GitHub Actions output issues
284305
FEEDBACK_CLEANED="$(echo "$FEEDBACK" | tr '\n' ' ')"
285306
echo "number=${PR_NUMBER}" >> $GITHUB_OUTPUT
286-
echo "feedback=${FEEDBACK_CLEANED}" >> $GITHUB_OUTPUT
307+
# Use EOF to properly handle special characters in GITHUB_OUTPUT
308+
echo "feedback<<EOF" >> $GITHUB_OUTPUT
309+
echo "$FEEDBACK_CLEANED" >> $GITHUB_OUTPUT
310+
echo "EOF" >> $GITHUB_OUTPUT
287311
288312
echo "comment_id=${COMMENT_ID}" >> $GITHUB_OUTPUT
289313
echo "file_path=${FILE_PATH}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)