File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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')
You can’t perform that action at this time.
0 commit comments