Skip to content

Commit

Permalink
add error message
Browse files Browse the repository at this point in the history
  • Loading branch information
cgundy committed Dec 9, 2024
1 parent da796fc commit 2a4409c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def get_changed_files(merge_base_sha: str, branch_head_sha: str) -> list[str]:
capture_output=True,
text=True,
)
if result.returncode != 0:
raise RuntimeError(f"git diff failed with exit code {result.returncode}: {result.stderr}")
changed_files = result.stdout.strip().split("\n")
return changed_files

Expand Down Expand Up @@ -65,6 +67,8 @@ def check_if_pr_is_blocked(env_vars: dict) -> None:
config = get_approved_files_config(repo)
approved_files = get_approved_files(config)
block_pr = not all(file in approved_files for file in changed_files)
print(f"changed_files: {changed_files}")
print(f"approved_files: {approved_files}")
if block_pr:
message = f"""Blocking PR because the changed files are not in the list of approved files.
Update config at: {BOT_APPROVED_FILES_PATH} if necessary.
Expand Down

0 comments on commit 2a4409c

Please sign in to comment.