File tree Expand file tree Collapse file tree 3 files changed +19
-5
lines changed
Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,12 @@ outputs:
118118 you'll need to run the action in workflow_run mode to post it. If
119119 "false", no comment file was written (likely because the comment was
120120 already posted to the PR).
121+ COVERAGE_PERCENTAGE :
122+ description : >
123+ The coverage percentage of the pull request.
124+ REFERENCE_COVERAGE_PERCENTAGE :
125+ description : >
126+ The coverage percentage of the base branch.
121127runs :
122128 using : docker
123129 image : Dockerfile
Original file line number Diff line number Diff line change 77import re
88import sys
99import zipfile
10+ from typing import Any
1011from urllib .parse import urlparse
1112
1213from coverage_comment import github_client , log
@@ -209,7 +210,7 @@ def post_comment(
209210 raise CannotPostComment from exc
210211
211212
212- def set_output (github_output : pathlib .Path | None , ** kwargs : bool ) -> None :
213+ def set_output (github_output : pathlib .Path | None , ** kwargs : Any ) -> None :
213214 if github_output :
214215 with github_output .open ("a" ) as f :
215216 for key , value in kwargs .items ():
Original file line number Diff line number Diff line change @@ -268,6 +268,11 @@ def process_pr(
268268 ],
269269 )
270270
271+ outputs = {
272+ "COVERAGE_PERCENTAGE" : coverage .info .percent_covered ,
273+ "REFERENCE_COVERAGE_PERCENTAGE" : previous_coverage_rate ,
274+ }
275+
271276 try :
272277 if config .FORCE_WORKFLOW_RUN or not pr_number :
273278 raise github .CannotPostComment
@@ -292,14 +297,16 @@ def process_pr(
292297 filename = config .FINAL_COMMENT_FILENAME ,
293298 content = comment ,
294299 )
295- github . set_output ( github_output = config . GITHUB_OUTPUT , COMMENT_FILE_WRITTEN = True )
300+ outputs |= { " COMMENT_FILE_WRITTEN" : True }
296301 log .debug ("Comment stored locally on disk" )
297302 else :
298- github .set_output (
299- github_output = config .GITHUB_OUTPUT , COMMENT_FILE_WRITTEN = False
300- )
303+ outputs |= {"COMMENT_FILE_WRITTEN" : False }
301304 log .debug ("Comment not generated" )
302305
306+ github .set_output (
307+ github_output = config .GITHUB_OUTPUT ,
308+ ** outputs ,
309+ )
303310 return 0
304311
305312
You can’t perform that action at this time.
0 commit comments