From 8ef53ba386f12bfd51567154bdf93f2e09a91e63 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 14 Sep 2023 13:16:31 -0700 Subject: [PATCH] fix: update request.py --- request.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/request.py b/request.py index 7f649ef..125dce9 100644 --- a/request.py +++ b/request.py @@ -6,7 +6,7 @@ payload = {'token': os.environ['API_KEY']} -link = 'https://codecov.io/api/gh/codecov/Swift-Standard' +link = 'https://api.codecov.io/api/v2/github/codecov/repos/Swift-Standard/commits' print("Waiting 60 seconds for report to upload before pinging API...") @@ -16,12 +16,12 @@ print("Pinging Codecov's API..") #get latest coverage data all_data = requests.get(link, params=payload).json() -commit_data = all_data['commits'][0] -coverage_percentage = commit_data['totals']['c'] +commit_data = all_data['results'][0] +coverage_percentage = commit_data['totals']['coverage'] print("Ensuring coverage percentage is accurate...") #result should return 86.66667 as its coverage metric -if(coverage_percentage == os.environ['CORRECT_COVERAGE']): +if(str(coverage_percentage) == os.environ['CORRECT_COVERAGE']): print("Success! Codecov's API returned the correct coverage percentage, "+ os.environ['CORRECT_COVERAGE']) exit(0) else: