Fix MATCH_COUNT grep bug (#614)

This commit is contained in:
Glenn Jocher
2025-10-28 16:54:33 +08:00
committed by GitHub
parent 5ece851432
commit bbccff8196
+1 -1
View File
@@ -236,7 +236,7 @@ runs:
COMMIT_MSG="Auto-format by https://ultralytics.com/actions"
# Check if last two commits were both auto-format to prevent recursive loops
LAST_TWO=$(git log -2 --pretty=format:'%s' 2>/dev/null || echo "")
MATCH_COUNT=$(printf '%s\n' "$LAST_TWO" | grep -Fxc "$COMMIT_MSG" || echo "0")
MATCH_COUNT=$(printf '%s\n' "$LAST_TWO" | grep -Fxc "$COMMIT_MSG" || true)
if [ "$MATCH_COUNT" -ge 2 ]; then
echo "Skipping commit: last two commits were auto-format"
exit 0