From 734ae152d5dd08229a70b4585c13ea86aa7e3469 Mon Sep 17 00:00:00 2001 From: Venu Vardhan Reddy Tekula Date: Mon, 22 Feb 2021 20:25:48 +0530 Subject: [PATCH] fix(github): send null job_id to fix 422 during resubmission If a submission is failed, the tool will check and adjust/resubmit again with a newly generated job_id. For GitHub Actions, this needs to be null again. --- coveralls/api.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/coveralls/api.py b/coveralls/api.py index 725ccc47..7c707970 100644 --- a/coveralls/api.py +++ b/coveralls/api.py @@ -235,9 +235,14 @@ def wear(self, dry_run=False): # attach a random value to ensure uniqueness # TODO: an auto-incrementing integer might be easier to reason # about if we could fetch the previous value - new_id = '{}-{}'.format( - self.config.get('service_job_id', 42), - random.randint(0, sys.maxsize)) + # N.B. Github Actions fails if this is not set to null. + # Other services fail if this is set to null. Sigh x2. + if os.environ.get('GITHUB_REPOSITORY'): + new_id = None + else: + new_id = '{}-{}'.format( + self.config.get('service_job_id', 42), + random.randint(0, sys.maxsize)) print('resubmitting with id {}'.format(new_id)) self.config['service_job_id'] = new_id