From 40b5ca1fd9b506b3bd3382012ef6b0bdec13aedb Mon Sep 17 00:00:00 2001 From: Croydon Date: Wed, 18 Nov 2020 17:49:17 +0100 Subject: [PATCH] auto-merge: receive up to 1000 checks --- .github/workflows/auto-merge.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/auto-merge.py b/.github/workflows/auto-merge.py index 8988caa..a6aef17 100644 --- a/.github/workflows/auto-merge.py +++ b/.github/workflows/auto-merge.py @@ -112,17 +112,21 @@ print("") # Our CI runs are all qualifing as checks # Since PyGithub is not yet supporting checks, we have to use something else here # https://github.com/PyGithub/PyGithub/issues/1621 -# TODO: Use only PyGithub one it supports checks +# TODO: Use only PyGithub once it supports checks -checks_api_call = subprocess.run( - 'curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/{}/commits/{}/check-runs'.format(REPOSITORY_SLUG, pr_latest_commit), - capture_output=True, - shell=True -) +checks = {} -checks_string = checks_api_call.stdout.decode("utf-8") +# Read up to 1000 checks +for page in range(1, 10): + checks_api_call = subprocess.run( + 'curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/{}/commits/{}/check-runs?per_page=100&page={}'.format(REPOSITORY_SLUG, pr_latest_commit, page), + capture_output=True, + shell=True + ) -checks = json.loads(checks_string) + checks_string = checks_api_call.stdout.decode("utf-8") + + checks.update(json.loads(checks_string)) checks_successful = 0