Skip to content

Commit 6ca9a20

Browse files
committed
JIRA-1234 Fix: Gemini API request for commit message generation
1 parent 663e72d commit 6ca9a20

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

git-commit-push-script.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ diff=$(git diff --cached)
1717
diff=$(echo $diff | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | sed 's/\n/\\n/g')
1818

1919
# Prepare the Gemini API request
20-
gemini_request='{"contents":[{"parts":[{"text": "Write a git commit message title (no more than 72 characters total) for the following git diff: '"$diff"' Do not include any other text in the repsonse."}]}]}'
20+
gemini_request='{
21+
"contents":[{"parts":[{"text": "Write a git commit message title (no more than 72 characters total) for the following git diff: '"$diff"' Do not include any other text in the repsonse."}]}],
22+
"safetySettings": [{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","threshold": "BLOCK_NONE"}],
23+
"generationConfig": {
24+
"temperature": 0.2,
25+
"maxOutputTokens": 50
26+
}
27+
}'
2128

2229
# Get commit message from Gemini API
2330
commit_message=$(curl -s \
@@ -47,7 +54,7 @@ remote_branch=$(git ls-remote --heads origin $base_branch)
4754
pull_push_after_failed_push() {
4855
echo "Push failed. Attempting to pull and push again."
4956
git pull
50-
git push
57+
git push --force
5158
}
5259

5360
# Check if the branch exists on the remote

0 commit comments

Comments
 (0)