Created
July 31, 2024 22:44
-
-
Save deekayen/8e024e2d3e7154515b180d82f3fa61a8 to your computer and use it in GitHub Desktop.
Copy a Rescuetime post-commit hook configuration file for highlighting commits in my timeline
This file contains 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
chmod +x post-commit | |
find . -name hooks -type d -maxdepth 4 -exec cp post-commit {} \; |
This file contains 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 | |
# | |
# Log commit messages as a 'highlight' in RescueTime Premium | |
# | |
# To enable this hook: | |
# | |
# 1. Place this file in your project's .git/hooks directory and make sure its name is "post-commit". | |
# 2. Make sure it has executable permissions (chmod +x post-commit) | |
# 3. All commits will be automatically logged as highlight events. | |
# | |
API_KEY=BLTy1B2YOHLM_64gJyGqTRP_cnP8CPUU685bcBLM | |
# REQUIRED FIELDS - Today's date and commit message | |
MESSAGE=$(git log -1 HEAD --pretty=format:%s) | |
DATE_TODAY=$(date +"%Y-%m-%d %H:%M:%S") | |
# OPTIONAL - Label | |
LABEL='code commit' | |
if [[ ${#MESSAGE} -gt 20 ]]; then | |
curl --data "key=$API_KEY&highlight_date=$DATE_TODAY&description=$MESSAGE&source=$LABEL" https://www.rescuetime.com/anapi/highlights_post | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment