@@ -69,34 +69,9 @@ def get_changed_files(repo_root):
6969
7070def extract_changed_sql_queries (file_path , base_commit , current_commit ):
7171 """Extract SQL code blocks that were added or modified in the git diff"""
72- try :
73- # Get the git diff for this specific file
74- diff_cmd = ["git" , "diff" , f"{ base_commit } ...{ current_commit } " , "--" , file_path ]
75- result = subprocess .run (diff_cmd , capture_output = True , text = True , cwd = get_repo_root ())
76-
77- if result .returncode != 0 :
78- print (f"::warning::Could not get git diff for { file_path } " )
79- return extract_sql_queries (file_path ) # Fallback to all queries
80-
81- diff_content = result .stdout
82-
83- # Simple approach: if there are any changes in the file and it contains SQL blocks,
84- # validate all SQL blocks in the current version of the file
85- # This is more reliable than trying to parse complex diff output
86-
87- has_changes = any (line .startswith (('+' , '-' )) for line in diff_content .split ('\n ' )
88- if line .strip () and not line .startswith (('+++' , '---' )))
89-
90- if has_changes :
91- # File has changes, extract all current SQL queries for validation
92- return extract_sql_queries (file_path )
93-
94- return []
95-
96- except Exception as e :
97- print (f"::error::Error extracting changed SQL queries from { file_path } : { e } " )
98- # Fallback to extracting all SQL queries from the file
99- return extract_sql_queries (file_path )
72+ # For now, simplify by validating all SQL in changed files
73+ # This is more reliable than complex diff parsing
74+ return extract_sql_queries (file_path )
10075
10176def extract_sql_queries (file_path ):
10277 """Extract SQL code blocks from markdown files (fallback method)"""
0 commit comments