Skip to content

Commit

Permalink
chore(IDX): fix bot workflow (#79)
Browse files Browse the repository at this point in the history
* chore(IDX): fix bot workflow

* add error message
  • Loading branch information
cgundy authored Dec 9, 2024
1 parent 8abb537 commit 23dbe61
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/repo_policies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: dfinity/public-workflows

- name: Python Setup
uses: ./.github/workflows/python-setup
Expand Down
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 23dbe61

Please sign in to comment.