Skip to content

Commit 844dd47

Browse files
authored
Enhance feature request workflow with regex and trimming
1 parent 1c23a9f commit 844dd47

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

.github/workflows/feature-request-enhance.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
run: |
6161
set -e
6262
BODY="${{ github.event.issue.body }}"
63-
if echo "$BODY" | grep -q "## .*Enhanced Feature Request"; then
63+
if echo "$BODY" | grep -qE "## .*Enhanced Feature Request"; then
6464
echo "already_enhanced=true" >> "$GITHUB_OUTPUT"
6565
else
6666
echo "already_enhanced=false" >> "$GITHUB_OUTPUT"
@@ -149,7 +149,7 @@ jobs:
149149
OUTPUT=$(node .github/agent/create-confluence.mjs 2>&1)
150150
echo "$OUTPUT"
151151
152-
URL=$(echo "$OUTPUT" | grep "CONFLUENCE_URL:" | sed 's/CONFLUENCE_URL://')
152+
URL=$(echo "$OUTPUT" | grep "CONFLUENCE_URL:" | sed 's/CONFLUENCE_URL://' | tr -d '[:space:]')
153153
echo "confluence_url=$URL" >> "$GITHUB_OUTPUT"
154154
155155
update-issue:
@@ -174,10 +174,10 @@ jobs:
174174
175175
# Fetch original issue body (as-is)
176176
ORIGINAL=$(curl -s \
177-
-H "Authorization: token $GITHUB_TOKEN" \
178-
-H "Accept: application/vnd.github+json" \
179-
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" \
180-
| jq -r '.body | split("## 📝 Enhanced Feature Request")[0] // ""')
177+
-H "Authorization: token $GITHUB_TOKEN" \
178+
-H "Accept: application/vnd.github+json" \
179+
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" \
180+
| jq -r '.body // "" | split("## 📝 Enhanced Feature Request")[0] // .')
181181
182182
183183
# Build Markdown body (NO escaped \n, real newlines)
@@ -225,9 +225,11 @@ EOF
225225
env:
226226
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
227227
run: |
228-
jq -n \
229-
--arg body "🤖 **Feature request enhanced!**\n\nIssue description and requirements are now structured and documented." \
230-
'{body:$body}' \
228+
COMMENT="🤖 **Feature request enhanced!**
229+
230+
Issue description and requirements are now structured and documented."
231+
232+
jq -n --arg body "$COMMENT" '{body:$body}' \
231233
| curl -X POST \
232234
-H "Authorization: token $GITHUB_TOKEN" \
233235
-H "Accept: application/vnd.github+json" \

0 commit comments

Comments
 (0)