chore(gitignore): add post-commit hook to .gitignore

This commit is contained in:
2026-07-01 14:44:09 +08:00
parent e7a3bb2dc5
commit 8219c951ba
2 changed files with 2 additions and 43 deletions
-43
View File
@@ -1,43 +0,0 @@
#!/bin/bash
set -u
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)"
SCRIPT_PATH="$REPO_ROOT/scripts/release/pre_release_web.sh"
LOG_FILE="$REPO_ROOT/logs/post-commit.log"
COMMIT_HASH="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)"
GIT_LOCAL_ENV_VARS="$(git rev-parse --local-env-vars 2>/dev/null || true)"
mkdir -p "$(dirname "$LOG_FILE")"
{
echo "=== post-commit @ $(date +%Y-%m-%dT%H:%M:%S%z) ==="
echo "repo: $REPO_ROOT"
echo "commit: $COMMIT_HASH"
echo "script: $SCRIPT_PATH"
echo ""
} > "$LOG_FILE"
if [ ! -x "$SCRIPT_PATH" ]; then
{
echo "=== ERROR: script not executable or not found ==="
echo "path: $SCRIPT_PATH"
echo "=== post-commit EXIT_CODE=127 @ $(date +%Y-%m-%dT%H:%M:%S%z) ==="
} >> "$LOG_FILE"
exit 127
fi
(
for var in $GIT_LOCAL_ENV_VARS; do
unset "$var"
done
"$SCRIPT_PATH"
) >> "$LOG_FILE" 2>&1
EXIT_CODE=$?
{
echo ""
echo "=== post-commit EXIT_CODE=$EXIT_CODE @ $(date +%Y-%m-%dT%H:%M:%S%z) ==="
} >> "$LOG_FILE"
exit "$EXIT_CODE"