Files
claude-howto/ja/06-hooks/notify-team.sh
JiangCheng 1d1df9235b feat(i18n): Add Japanese (ja/) translation (#105)
- Translate all 101 markdown files: P1 core, all 10 modules, examples,
  auxiliary docs (CONTRIBUTING, CODE_OF_CONDUCT, SECURITY, CLAUDE.md, etc.),
  peripheral docs (.github/, docs/, resources/, scripts/)
- Translate comments and user-facing messages in 06-hooks/*.sh examples
- Copy 05-mcp/*.json examples (standard JSON, no comments)
- Update root README.md language switcher to include 日本語
- Add ja/TRANSLATION_NOTES.md (glossary + style guide)

All translations pass pre-commit quality gates (markdown-lint,
cross-references, mermaid-syntax, link-check, build-epub).
2026-04-30 00:16:46 +02:00

69 lines
2.3 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# イベント発生時に通知を送信する
# フックPostToolUsematcher: Bash— bash コマンドの後に実行し、スクリプト側で git push を判別する
# 注Claude Code にネイティブの PostPush イベントは無い。git push をトリガにするには、
# matcher または本スクリプト内の条件で bash コマンド文字列に "git push" が含まれるかを確認する。
REPO_NAME=$(basename $(git rev-parse --show-toplevel 2>/dev/null) 2>/dev/null)
COMMIT_MSG=$(git log -1 --pretty=%B 2>/dev/null)
AUTHOR=$(git log -1 --pretty=%an 2>/dev/null)
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
echo "📢 チームへ通知を送信しています..."
# Slack Webhook の例Webhook URL は自分のものに置き換える)
SLACK_WEBHOOK="${SLACK_WEBHOOK_URL:-}"
if [ -n "$SLACK_WEBHOOK" ]; then
curl -X POST "$SLACK_WEBHOOK" \
-H 'Content-Type: application/json' \
-d "{
\"text\": \"*$REPO_NAME* に新しい push がありました\",
\"attachments\": [{
\"color\": \"good\",
\"fields\": [
{\"title\": \"ブランチ\", \"value\": \"$BRANCH\", \"short\": true},
{\"title\": \"作者\", \"value\": \"$AUTHOR\", \"short\": true},
{\"title\": \"コミット\", \"value\": \"$COMMIT_MSG\"}
]
}]
}" \
--silent --output /dev/null
echo "✅ Slack 通知を送信しました"
fi
# Discord Webhook の例Webhook URL は自分のものに置き換える)
DISCORD_WEBHOOK="${DISCORD_WEBHOOK_URL:-}"
if [ -n "$DISCORD_WEBHOOK" ]; then
curl -X POST "$DISCORD_WEBHOOK" \
-H 'Content-Type: application/json' \
-d "{
\"content\": \"**$REPO_NAME に新しい push がありました**\",
\"embeds\": [{
\"title\": \"$COMMIT_MSG\",
\"color\": 3066993,
\"fields\": [
{\"name\": \"ブランチ\", \"value\": \"$BRANCH\", \"inline\": true},
{\"name\": \"作者\", \"value\": \"$AUTHOR\", \"inline\": true}
]
}]
}" \
--silent --output /dev/null
echo "✅ Discord 通知を送信しました"
fi
# Email 通知の例
EMAIL_TO="${TEAM_EMAIL:-}"
if [ -n "$EMAIL_TO" ]; then
echo "$AUTHOR$REPO_NAME に push しました" | \
mail -s "Git Push: $BRANCH" "$EMAIL_TO"
echo "✅ Email 通知を送信しました"
fi
exit 0