Skip to content

Commit

Permalink
fix: update request.py
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu-codecov committed Sep 14, 2023
1 parent 7592a4e commit 8ef53ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...")

Expand All @@ -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:
Expand Down

0 comments on commit 8ef53ba

Please sign in to comment.