File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,16 @@ commit_message=$(curl -s \
34
34
| jq -r ' .candidates[0].content.parts[0].text'
35
35
)
36
36
37
+ # If the commit message is empty, try again
38
+ if [ -z " $commit_message " ]; then
39
+ commit_message=$( curl -s \
40
+ -H ' Content-Type: application/json' \
41
+ -d " $gemini_request " \
42
+ -X POST " https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=${GEMINI_API_KEY} " \
43
+ | jq -r ' .candidates[0].content.parts[0].text'
44
+ )
45
+ fi
46
+
37
47
# Clean up commit message formatting - remove #, ```,
38
48
commit_message=$( echo $commit_message | sed ' s/#//g' | sed ' s/```//g' | sed ' s/Commit message title://g' | sed ' s/Commit message summary://g' )
39
49
@@ -45,7 +55,11 @@ if [ -z "$commit_message" ]; then
45
55
fi
46
56
47
57
# Prepare and execute commit command
48
- git commit -S -m " $ticket $commit_message "
58
+ if [ -z " $ticket " ]; then
59
+ git commit -S -m " $commit_message "
60
+ else
61
+ git commit -S -m " $ticket $commit_message "
62
+ fi
49
63
50
64
# Check if the branch exists on the remote
51
65
remote_branch=$( git ls-remote --heads origin $base_branch )
You can’t perform that action at this time.
0 commit comments