Skip to content

Precise normal from plane, fixed ZeroDivisionError #39

Precise normal from plane, fixed ZeroDivisionError

Precise normal from plane, fixed ZeroDivisionError #39

name: Google Chat Notification
on:
pull_request:
types: [opened, reopened, closed]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send notification to Google Chat
env:
WEBHOOK_URL: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_ACTION: ${{ github.event.action }}
run: |
if [ -z "$WEBHOOK_URL" ]; then
echo "Error: WEBHOOK_URL is not set. Please check your GitHub Secrets."
exit 1
fi
MESSAGE="Pull Request $PR_ACTION:\\n$PR_TITLE\\n$PR_URL"
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST -H "Content-Type: application/json" -d "{\"text\": \"$MESSAGE\"}" "$WEBHOOK_URL")
if [ "$RESPONSE" != "200" ]; then
echo "Error: Failed to send notification. HTTP status code: $RESPONSE"
exit 1
else
echo "Notification sent successfully"
fi