Skip to content

Commit

Permalink
Update summarize-log.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
chrypnotoad authored Sep 24, 2024
1 parent cb42212 commit 817364b
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/summarize-log.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,22 @@ jobs:
-d "$JSON_PAYLOAD" \
"https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=${GEMINI_API_KEY}")
# Check if curl command was successful
if [ $? -ne 0 ]; then
echo "Error: Failed to call Gemini API."
echo "Gemini API Response: $RESPONSE"
# Extract HTTP status code
HTTP_STATUS=$(echo "$RESPONSE" | grep HTTP_STATUS | awk -F: '{print $2}')
# Extract the JSON body
RESPONSE_BODY=$(echo "$RESPONSE" | sed -e 's/HTTP_STATUS\:.*//g')
echo "HTTP Status Code: $HTTP_STATUS"
echo "Response Body: $RESPONSE_BODY"
# Check if the HTTP status code indicates success
if [[ "$HTTP_STATUS" -ge 200 && "$HTTP_STATUS" -lt 300 ]]; then
echo "Gemini API call successful."
else
echo "Error: Gemini API returned status code $HTTP_STATUS."
echo "Response Body: $RESPONSE_BODY"
exit 1
fi
Expand All @@ -58,7 +71,6 @@ jobs:
exit 1
fi
# Set the summary as an environment variable for the next step
echo "SUMMARY<<EOF" >> $GITHUB_ENV
echo "$SUMMARY" >> $GITHUB_ENV
Expand Down

0 comments on commit 817364b

Please sign in to comment.