Skip to content

Commit

Permalink
Report 0% if coverage did not change (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkWanderer authored Nov 12, 2023
1 parent 133f955 commit 26f3f06
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/coverage-status.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ def post_status(repository: str, sha: str, state: str, context: str, description
elif ext == '.json':
with open(args.coverage_file) as f:
data = json.load(f)
chnge = data['total']["Cover"]
stmts = data['total']["Stmts"]
post_status(args.repository, args.sha, "success", "Coverage / Diff",
f"change: {chnge}, statements: {stmts}")
chnge = "0%" if stmts == "0" else data['total']["Cover"]
post_status(args.repository, args.sha, "success", "Coverage / Change", f"{chnge}, statements: {stmts}")
else:
raise Exception(f'Unknown file type {ext} for {args.coverage_file}')

0 comments on commit 26f3f06

Please sign in to comment.