Skip to content

Commit

Permalink
shorten message when PR is opened
Browse files Browse the repository at this point in the history
  • Loading branch information
truib committed Mar 13, 2024
1 parent 3c060b5 commit a307ae5
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions eessi_bot_event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,19 @@ def handle_pull_request_opened_event(self, event_info, pr):
arch_map = get_architecture_targets(self.cfg)
repo_cfg = get_repo_cfg(self.cfg)

comment = f"Instance `{app_name}` is configured to build:"

for arch in arch_map.keys():
# check if repo_target_map contains an entry for {arch}
if arch not in repo_cfg[REPO_TARGET_MAP]:
self.log(f"skipping arch {arch} because repo target map does not define repositories to build for")
continue
for repo_id in repo_cfg[REPO_TARGET_MAP][arch]:
comment += f"\n- arch `{'/'.join(arch.split('/')[1:])}` for repo `{repo_id}`"
comment = f"Instance `{app_name}` is configured to build for:"
architectures = ['/'.join(arch.split('/')[1:]) for arch in arch_map.keys()]
comment += "- architectures: "
if len(architectures) > 0:
comment += f"{', '.join([f"`{arch}`" for arch in architectures])}"
else:
comment += "none"
repositories = [repo_id for repo_id in repo_cfg[REPO_TARGET_MAP].keys()]
comment += "- repositories: "
if len(repositories) > 0:
comment += f"{', '.join([f"`{repo_id}`" for repo_id in repositories])}"
else:
comment += "none"

self.log(f"PR opened: comment '{comment}'")

Expand Down

0 comments on commit a307ae5

Please sign in to comment.