Skip to content

Commit

Permalink
infinite loop when aggregating workflow dispatches
Browse files Browse the repository at this point in the history
  • Loading branch information
erwan-b committed May 19, 2022
1 parent c200fa5 commit e90595e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions bert_e/git_host/github/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def is_pending(self):
elem for elem in self._check_suites if elem['status'] == 'pending'
]) > 0

def _get_aggregate_workflow_dispatched(self, page):
def _get_aggregate_workflow_dispatched(self, page, prev_dispatches=list()):
"""Return a list of check-suite IDs for workflow_dispatch runs"""

response = AggregatedWorkflowRuns.get(
Expand All @@ -567,12 +567,15 @@ def _get_aggregate_workflow_dispatched(self, page):
'per_page': 100
})

workflow_dispatches = response.check_suite_ids
while len(response.workflow_runs) < response.total_count:
prev_dispatches.extend(response.check_suite_ids)
if len(prev_dispatches) < response.total_count:
page += 1
workflow_dispatches.update(
self._get_aggregate_workflow_dispatched(page))
return workflow_dispatches
return self._get_aggregate_workflow_dispatched(
page,
prev_dispatches
)

return prev_dispatches

def remove_unwanted_workflows(self):
"""
Expand Down

0 comments on commit e90595e

Please sign in to comment.