From 5e9af5c1b37dc7125dd48090a7fab9b80c3b4d38 Mon Sep 17 00:00:00 2001 From: folhesgabriel Date: Fri, 19 Apr 2024 10:35:57 -0300 Subject: [PATCH] fix: check_sql_files action --- .github/workflows/scripts/check_sql_files.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/scripts/check_sql_files.py b/.github/workflows/scripts/check_sql_files.py index b30fb186..6e794fc2 100644 --- a/.github/workflows/scripts/check_sql_files.py +++ b/.github/workflows/scripts/check_sql_files.py @@ -1,23 +1,24 @@ import argparse +import os def check_sql_files(file): found_staging = False - if file.endswith(".sql"): + if os.path.exists(file) and file.endswith(".sql"): with open(file, "r") as f: lines = f.readlines() for line in lines: - if "basedosdados-dev" in line: + if "basedosdados-staging" in line: found_staging = True - print(f"Found 'basedosdados-dev' in {file}") + print(f"Found 'basedosdados-staging' in {file}") break return found_staging if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Check for 'basedosdados-dev' occurrences in SQL files.") + parser = argparse.ArgumentParser(description="Check for 'basedosdados-staging' occurrences in SQL files.") parser.add_argument("file", help="Path to the SQL file to check") args = parser.parse_args() if check_sql_files(args.file): exit(1) else: - print("No occurrences of 'basedosdados-dev' found in SQL files.") \ No newline at end of file + print("No occurrences of 'basedosdados-staging' found in SQL files.")