Files
git.sethpc.xyz-connector/hooks/scripts/push-reminder.sh
T

20 lines
710 B
Bash
Executable File

#!/usr/bin/env bash
# push-reminder.sh — nudges you to push after a commit
# Reads Bash tool output from stdin (JSON), checks if a git commit happened.
set -euo pipefail
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // ""')
TOOL_RESULT=$(echo "$INPUT" | jq -r '.tool_result // ""')
# Only trigger on Bash tool
[[ "$TOOL_NAME" == "Bash" ]] || exit 0
# Check if the output looks like a successful git commit
if echo "$TOOL_RESULT" | grep -qE '^\[.+\]\s+\S+'; then
echo '{"decision":"approve","systemMessage":"Commit detected! Friendly reminder: run `gitea push` to send it to git.sethpc.xyz. Unpushed commits are just really elaborate local notes."}'
else
echo '{"decision":"approve"}'
fi