Skip to content

Commit b9ba748

Browse files
committed
fix: add max-lines input to limit processed file size and skip large files in PHP auto-fix action
1 parent 41d76a6 commit b9ba748

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

booster/.github/actions/php-auto-fix/action.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ inputs:
2828
required: false
2929
default: "*.php"
3030

31+
max-lines:
32+
description: "Maximum lines of code to process (default: 500)"
33+
required: false
34+
default: "500"
35+
3136
outputs:
3237
changes-made:
3338
description: "Whether any changes were made"
@@ -112,11 +117,24 @@ runs:
112117
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD -- '${{ inputs.file-pattern }}' 2>/dev/null | tr '\n' ' ' || echo "")
113118
fi
114119
115-
# Filter to only existing files
120+
# Filter to only existing files and check line count
116121
EXISTING_FILES=""
122+
MAX_LINES=${{ inputs.max-lines }}
123+
117124
for file in $CHANGED_FILES; do
118125
if [ -f "$file" ]; then
119-
EXISTING_FILES="$EXISTING_FILES $file"
126+
# Skip vendor files
127+
if [[ "$file" == vendor/* ]] || [[ "$file" == */vendor/* ]]; then
128+
echo "ℹ️ Skipping vendor file: $file"
129+
continue
130+
fi
131+
132+
LINE_COUNT=$(wc -l < "$file" 2>/dev/null || echo "0")
133+
if [ "$LINE_COUNT" -le "$MAX_LINES" ]; then
134+
EXISTING_FILES="$EXISTING_FILES $file"
135+
else
136+
echo "⚠️ Skipping large file: $file (${LINE_COUNT} lines > ${MAX_LINES} lines)"
137+
fi
120138
fi
121139
done
122140

0 commit comments

Comments
 (0)