Skip to content

Commit 0eb1f3d

Browse files
author
Involvex
committed
feat: update Gemini AI release notes generation to always run and improve JSON payload handling
1 parent 24075b8 commit 0eb1f3d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/auto-version.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,19 @@ jobs:
113113
echo "- **Date**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> RELEASE_NOTES.md
114114
115115
- name: Generate release notes with Gemini AI
116-
if: steps.version.outputs.version-changed == 'true' && steps.draft-release.outputs.draft-release == 'true'
116+
if: steps.version.outputs.version-changed == 'true'
117117
env:
118118
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
119119
run: |
120120
sudo apt-get update && sudo apt-get install -y jq
121-
COMMITS=$(git log -10 --pretty=format:"%s" | jq -Rs .)
121+
COMMITS=$(git log -10 --pretty=format:"%s" | jq -R -s -c '.')
122122
PROMPT="Write concise, user-friendly release notes for these commits: $COMMITS"
123+
# Use jq to build the JSON payload safely
124+
jq -n --arg prompt "$PROMPT" \
125+
'{contents: [{parts: [{text: $prompt}]}]}' > payload.json
123126
RESPONSE=$(curl -s -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$GEMINI_API_KEY" \
124127
-H "Content-Type: application/json" \
125-
-d "{\"contents\":[{\"parts\":[{\"text\":$PROMPT}]}]}" )
128+
-d @payload.json)
126129
echo "Gemini raw response:" >&2
127130
echo "$RESPONSE" >&2
128131
NOTES=$(echo "$RESPONSE" | jq -r '.candidates[0].content.parts[0].text')

0 commit comments

Comments
 (0)