Created
May 20, 2025 12:04
-
-
Save arrow2nd/ad9e482d2ae113e1f4eed0b8f3df1a2b to your computer and use it in GitHub Desktop.
PulsoidのAPIを叩いて、「このコミット時にどんだけドキドキしてたか」を残すgit hooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# PulsoidのAPIトークンは環境変数から取得 | |
PULSOID_TOKEN="${PULSOID_TOKEN:-}" | |
if [ -z "$PULSOID_TOKEN" ]; then | |
echo "⚠️ PULSOID_TOKENが設定されていません。" | |
exit 1 | |
fi | |
HEART_RATE=$(curl -s -H "Authorization: Bearer $PULSOID_TOKEN" \ | |
"https://dev.pulsoid.net/api/v1/data/heart_rate/latest?response_mode=text_plain_only_heart_rate") | |
if [ -z "$HEART_RATE" ]; then | |
HEART_RATE="N/A" | |
fi | |
COMMIT_MSG_FILE="$1" | |
sed -i.bak "1i\\ | |
[💗 $HEART_RATE bpm] | |
" "$COMMIT_MSG_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tokenを生成して
$PULSOID_TOKEN
に入れておく任意のプロジェクトの
.git/hooks
以下に配置すればok