Skip to content

Commit 899c089

Browse files
committed
Add comprehensive debugging to identify file processing issue
- Enhanced environment variable debugging - Added changed_files.txt content inspection - Improved exit handling with clear summary when no files need validation - Will help identify why 484 files are being processed instead of just changed files
1 parent 362d343 commit 899c089

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

β€Žscripts/validate_queries.pyβ€Ž

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,31 @@ def debug_environment():
2121
print("::group::βš™οΈ Environment Debug")
2222
print(f"πŸ“‚ Repo root: {repo_root}")
2323
print(f"πŸ“‚ Working dir: {os.getcwd()}")
24+
print(f"πŸ“‚ BASE_COMMIT: {os.getenv('BASE_COMMIT', 'NOT SET')}")
25+
print(f"πŸ“‚ CURRENT_COMMIT: {os.getenv('CURRENT_COMMIT', 'NOT SET')}")
26+
print(f"πŸ“‚ GITHUB_EVENT_PATH: {os.getenv('GITHUB_EVENT_PATH', 'NOT SET')}")
27+
28+
# Check if changed_files.txt exists and show content
29+
changed_files_txt = repo_root / "changed_files.txt"
30+
if changed_files_txt.exists():
31+
print(f"πŸ“‚ changed_files.txt exists, size: {changed_files_txt.stat().st_size} bytes")
32+
try:
33+
with open(changed_files_txt) as f:
34+
content = f.read()
35+
lines = content.strip().split('\n') if content.strip() else []
36+
print(f"πŸ“‚ changed_files.txt contains {len(lines)} lines")
37+
if lines:
38+
print("πŸ“‚ First 5 files:")
39+
for line in lines[:5]:
40+
print(f" {line}")
41+
except Exception as e:
42+
print(f"πŸ“‚ Error reading changed_files.txt: {e}")
43+
else:
44+
print("πŸ“‚ changed_files.txt does not exist")
45+
2446
print("\nπŸ“ Directory Structure:")
2547
os.system(f"find {repo_root} -maxdepth 3 -type d | sort")
26-
print("\nπŸ“ Markdown Files:")
48+
print("\nπŸ“ Markdown Files (sample):")
2749
os.system(f"find {repo_root} -name '*.md' | head -n 20")
2850
print("::endgroup::")
2951
return repo_root
@@ -247,7 +269,15 @@ def main():
247269
changed_files = get_changed_files(repo_root)
248270

249271
if not changed_files:
250-
print("::warning::No Markdown files to validate")
272+
print("::warning::No Markdown files to validate - exiting successfully")
273+
print("\n" + "="*60)
274+
print("πŸ“Š VALIDATION SUMMARY")
275+
print("="*60)
276+
print("πŸ“ Files processed: 0")
277+
print("πŸ“Š Changed SQL queries: 0")
278+
print("βœ… Files passed: 0")
279+
print("❌ Files failed: 0")
280+
print("\nπŸŽ‰ No SQL query changes to validate!")
251281
sys.exit(0)
252282

253283
# Get git commit information for diff-based validation

0 commit comments

Comments
Β (0)