Skip to content

Commit c9b914a

Browse files
committedSep 23, 2024··
ABC-1234 Refactor: Remove commit message summary generation This commit removes the logic that generates a commit message summary from the Gemini API response. The script now only focuses on generating a commit message title, adhering to the 72 character limit.
2 parents 105d134 + cdf82de commit c9b914a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎git-commit-push-script.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ 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 (commit message title 72 character maximum and commit message summary 50 character maxiumum) for the following git diff: '"$diff"' The format should be as follows (without titles, back ticks, or markdown fomatting): <commit message title> (2 new lines) <commit message summary>"}]}]}'
20+
gemini_request='{"contents":[{"parts":[{"text": "Write a git commit message title (72 character maximum) for the following git diff: '"$diff"' "}]}]}'
2121

2222
# Get commit message from Gemini API
2323
commit_message=$(curl -s \
@@ -27,6 +27,9 @@ commit_message=$(curl -s \
2727
| jq -r '.candidates[0].content.parts[0].text'
2828
)
2929

30+
# Clean up commit message formatting - remove #, ```
31+
commit_message=$(echo $commit_message | sed 's/#//g' | sed 's/```//g' | sed 's/Commit message title://g' | sed 's/Commit message summary://g')
32+
3033
# Prepare and execute commit command
3134
git commit -S -m "$ticket $commit_message"
3235

0 commit comments

Comments
 (0)
Please sign in to comment.