feat: git-audit auto-commits and pushes owned repos

This commit is contained in:
James 2026-02-07 16:32:07 -05:00
parent b5cbd61224
commit d02f522cbc
1 changed files with 14 additions and 0 deletions

View File

@ -55,6 +55,20 @@ audit_repo() {
fi
fi
# Auto-commit repos I own (skip inou — Johan's code)
if [ "$DIRTY_COUNT" -gt 0 ] && [ "$repo" != "inou" ]; then
git -C "$dir" add -A 2>/dev/null
git -C "$dir" commit -m "chore: auto-commit uncommitted changes" --quiet 2>/dev/null && {
AHEAD=$(git -C "$dir" rev-list --count "origin/$BRANCH..HEAD" 2>/dev/null || echo 0)
}
DIRTY_COUNT=0
fi
# Auto-push if ahead
if [ "$AHEAD" -gt 0 ] && [ "$repo" != "inou" ]; then
timeout 5 git -C "$dir" push origin "$BRANCH" --quiet 2>/dev/null && AHEAD=0 || true
fi
[ "$DIRTY_COUNT" -gt 0 ] && ANOMALIES+="⚠️ $repo: $DIRTY_COUNT uncommitted file(s)\n"
[ "$AHEAD" -gt 0 ] && ANOMALIES+="🔺 $repo: $AHEAD unpushed commit(s) on $BRANCH\n"
}