try again
This commit is contained in:
parent
20e03982c6
commit
ae5909a6bd
1 changed files with 34 additions and 10 deletions
44
.github/workflows/pr_checks.yml
vendored
44
.github/workflows/pr_checks.yml
vendored
|
|
@ -53,35 +53,59 @@ jobs:
|
|||
- name: Show formatting differences for all files
|
||||
run: |
|
||||
echo "Running prettier check to find unformatted files..."
|
||||
# Capture prettier output to a temp file
|
||||
npx prettier --check . > /tmp/prettier_output.txt 2>&1 || true
|
||||
# Capture prettier output without colors
|
||||
npx prettier --no-color --check . > /tmp/prettier_output.txt 2>&1 || true
|
||||
|
||||
echo "Full prettier output:"
|
||||
cat /tmp/prettier_output.txt
|
||||
echo ""
|
||||
|
||||
# Extract files that need formatting
|
||||
UNFORMATTED_FILES=$(grep -E '^\[warn\]' /tmp/prettier_output.txt | sed 's/\[warn\] //' || true)
|
||||
# Debug: show raw bytes of the output
|
||||
echo "Raw output (showing first 500 bytes):"
|
||||
head -c 500 /tmp/prettier_output.txt | hexdump -C
|
||||
echo ""
|
||||
|
||||
# Extract files that need formatting (try multiple patterns)
|
||||
echo "Trying different grep patterns:"
|
||||
echo "Pattern 1 - looking for [warn]:"
|
||||
grep '\[warn\]' /tmp/prettier_output.txt || echo "No matches for [warn]"
|
||||
echo "Pattern 2 - looking for warn:"
|
||||
grep 'warn' /tmp/prettier_output.txt || echo "No matches for warn"
|
||||
echo "Pattern 3 - lines containing file extensions:"
|
||||
grep -E '\.(ts|tsx|js|jsx|yml|yaml|json)' /tmp/prettier_output.txt || echo "No file extensions found"
|
||||
|
||||
# Try to extract filenames more robustly
|
||||
UNFORMATTED_FILES=$(grep '\[warn\]' /tmp/prettier_output.txt | sed 's/.*\[warn\][[:space:]]*//' || true)
|
||||
|
||||
if [ -z "$UNFORMATTED_FILES" ]; then
|
||||
echo "No files found in [warn] messages."
|
||||
else
|
||||
echo "No files found in [warn] messages. Trying alternative extraction..."
|
||||
# Alternative: look for lines that look like file paths
|
||||
UNFORMATTED_FILES=$(grep -E '^[^\[]*\.(ts|tsx|js|jsx|yml|yaml|json)' /tmp/prettier_output.txt || true)
|
||||
fi
|
||||
|
||||
if [ -n "$UNFORMATTED_FILES" ]; then
|
||||
echo "Files that need formatting:"
|
||||
echo "$UNFORMATTED_FILES"
|
||||
echo ""
|
||||
echo "Showing diffs for each file:"
|
||||
echo "$UNFORMATTED_FILES" | while IFS= read -r file; do
|
||||
if [ -n "$file" ] && [ -f "$file" ]; then
|
||||
# Clean up the filename (remove any remaining brackets or whitespace)
|
||||
clean_file=$(echo "$file" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//')
|
||||
if [ -n "$clean_file" ] && [ -f "$clean_file" ]; then
|
||||
echo "======================================"
|
||||
echo "Diff for: $file"
|
||||
echo "Diff for: $clean_file"
|
||||
echo "======================================"
|
||||
# Create formatted version
|
||||
npx prettier "$file" > "/tmp/formatted_$(basename "$file")"
|
||||
npx prettier --no-color "$clean_file" > "/tmp/formatted_$(basename "$clean_file")"
|
||||
# Show diff
|
||||
diff -u "$file" "/tmp/formatted_$(basename "$file")" || true
|
||||
diff -u "$clean_file" "/tmp/formatted_$(basename "$clean_file")" || true
|
||||
echo ""
|
||||
else
|
||||
echo "File not found or empty: '$clean_file'"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Still no files found. This might indicate a parsing issue."
|
||||
fi
|
||||
|
||||
- name: Check code formatting
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue