[追加] Git hooks: pre-commit ロック検証 + post-commit Issue 自動更新 (#66)
scripts/pre-commit-lock-check.sh: - コミット前にファイルロックを検証 - POLARIS_AGENT_ID 環境変数でエージェント識別 - ロック保持者以外の変更を exit 1 で拒否 scripts/post-commit-issue-update.sh: - コミットメッセージから #N を抽出 - gh issue comment で自動更新 - cargo test 結果も添付 - バックグラウンド実行(コミットをブロックしない) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ec1d25887e
commit
553eed3b5d
2 changed files with 100 additions and 0 deletions
36
scripts/post-commit-issue-update.sh
Executable file
36
scripts/post-commit-issue-update.sh
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
# Polaris: コミット後に関連 Issue を自動更新する post-commit hook
|
||||
#
|
||||
# コミットメッセージに (#52, #53) のような Issue 番号があれば、
|
||||
# 自動で gh issue comment を実行する。
|
||||
|
||||
REPO="Miyabi-G-K/miyabi-cli-standalone"
|
||||
|
||||
# 直前のコミット情報を取得
|
||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
COMMIT_MSG=$(git log -1 --pretty=%B)
|
||||
AUTHOR=$(git log -1 --pretty=%an)
|
||||
|
||||
# コミットメッセージから Issue 番号を抽出 (#52, #53 等)
|
||||
ISSUE_NUMS=$(echo "$COMMIT_MSG" | grep -oE '#[0-9]+' | sed 's/#//')
|
||||
|
||||
if [ -z "$ISSUE_NUMS" ]; then
|
||||
exit 0 # Issue 番号がなければ何もしない
|
||||
fi
|
||||
|
||||
# 各 Issue にコメントを投稿
|
||||
for NUM in $ISSUE_NUMS; do
|
||||
gh issue comment "$NUM" \
|
||||
--repo "$REPO" \
|
||||
--body "✅ **コミット反映**: \`$COMMIT_HASH\` by $AUTHOR
|
||||
|
||||
\`\`\`
|
||||
$COMMIT_MSG
|
||||
\`\`\`
|
||||
|
||||
cargo test: $(cargo test 2>&1 | grep 'test result' | tail -1)" \
|
||||
2>/dev/null &
|
||||
done
|
||||
|
||||
# バックグラウンドで実行(コミットをブロックしない)
|
||||
wait
|
||||
Loading…
Add table
Add a link
Reference in a new issue