Skip to content

Commit

Permalink
Fix bot PR state calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyBourne committed Feb 15, 2024
1 parent 9ef6973 commit 7f40476
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ci_tools/bot_tools/bot_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,15 @@ def run_tests(self, tests, python_version = None, force_run = False):
self._GAI.create_comment(self._pr_id, "There are unrecognised tests.\n"+message_from_file('show_tests.txt'))
return []
else:
check_runs = self._GAI.get_check_runs(self._ref)['check_runs']
already_triggered = [c["name"] for c in check_runs if c['status'] in ('completed', 'in_progress') and \
c['conclusion'] != 'cancelled' and \
c['name'] not in ('coverage',)]
check_runs = {self.get_name_key(c["name"]): c for c in self._GAI.get_check_runs(self._ref)['check_runs']}
already_triggered = [c["name"] for n,c in check_runs.items() if c['status'] in ('completed', 'in_progress') and \
c['conclusion'] != 'cancelled' and \
n != 'coverage']
already_triggered_names = [self.get_name_key(t) for t in already_triggered]
already_programmed = {c["name"]:c for c in check_runs if c['status'] == 'queued'}
success_names = [self.get_name_key(c["name"]) for c in check_runs if c['status'] == 'completed' and c['conclusion'] == 'success']
already_programmed = {c["name"]:c for c in check_runs.values() if c['status'] == 'queued'}
success_names = [n for n,c in check_runs.items() if c['status'] == 'completed' and c['conclusion'] == 'success']
print(already_triggered)
states = [c['conclusion'] for c in check_runs if c['status'] == 'completed']
states = []

if not force_run:
# Get a list of all commits on this branch
Expand All @@ -317,6 +317,7 @@ def run_tests(self, tests, python_version = None, force_run = False):
pv = python_version or default_python_versions[t]
key = f"({t}, {pv})"
if any(key in a for a in already_triggered):
states.append(check_runs[t]['conclusion'])
continue
name = f"{test_names[t]} {key}"
if not force_run and not self.is_test_required(commit_log, name, t, states):
Expand Down Expand Up @@ -555,6 +556,7 @@ def request_mark_as_ready(self):
_, err = p.communicate()
print(err)

print(states)
if all(s == 'success' for s in states):
self.mark_as_ready(False)

Expand Down

0 comments on commit 7f40476

Please sign in to comment.