Skip to content

Commit b631559

Browse files
committed
Fix validation script to only process changed files
- Updated where.md with missing reducer functions documentation - Fixed validate_queries.py to properly detect changed files via git diff - Prevents processing all 484 files and failing on pre-existing issues
1 parent 09972fa commit b631559

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

scripts/validate_queries.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,27 @@ def get_changed_files(repo_root):
5757
except Exception as e:
5858
print(f"::warning::Couldn't read PR data: {e}")
5959

60-
# Fallback: Scan docs directory
61-
docs_dir = repo_root / "docs"
62-
if docs_dir.exists():
63-
md_files = list(docs_dir.rglob("*.md"))
64-
print(f"🔄 Scanning {len(md_files)} docs files")
65-
return [str(f) for f in md_files]
60+
# Use git diff to find changed files as fallback
61+
try:
62+
base_commit = os.getenv('BASE_COMMIT')
63+
current_commit = os.getenv('CURRENT_COMMIT')
64+
65+
if base_commit and current_commit:
66+
print(f"🔍 Using git diff fallback: {base_commit}...{current_commit}")
67+
result = subprocess.run([
68+
'git', 'diff', '--name-only', '--diff-filter=AM',
69+
f'{base_commit}...{current_commit}', '--', '**/*.md'
70+
], capture_output=True, text=True, cwd=repo_root)
71+
72+
if result.returncode == 0:
73+
files = [line.strip() for line in result.stdout.split('\n') if line.strip()]
74+
if files:
75+
print(f"� Found {len(files)} changed files via git diff")
76+
return [str(repo_root / f) for f in files]
77+
except Exception as e:
78+
print(f"::warning::Git diff fallback failed: {e}")
6679

67-
print("::error::No Markdown files found in docs/ directory")
80+
print("::warning::No changed files detected, exiting successfully")
6881
return []
6982

7083
def extract_changed_sql_queries(file_path, base_commit, current_commit):

0 commit comments

Comments
 (0)