@@ -249,7 +249,7 @@ def list_source_files(
249249 if not is_file_in_list (
250250 ignored_paths , file_path , "ignored"
251251 ) or is_file_in_list (not_ignored , file_path , "not ignored" ):
252- Globals .FILES .append (dict ( filename = file_path ) )
252+ Globals .FILES .append ({ " filename" : file_path } )
253253
254254 if Globals .FILES :
255255 logger .info (
@@ -318,9 +318,10 @@ def run_clang_tidy(
318318 if not PurePath (database ).is_absolute ():
319319 database = str (Path (RUNNER_WORKSPACE , repo_root , database ).resolve ())
320320 cmds .append (database )
321- line_ranges = dict (
322- name = filename , lines = range_of_changed_lines (file_obj , lines_changed_only , True )
323- )
321+ line_ranges = {
322+ "name" : filename ,
323+ "lines" : range_of_changed_lines (file_obj , lines_changed_only , True ),
324+ }
324325 if line_ranges ["lines" ]:
325326 # logger.info("line_filter = %s", json.dumps([line_ranges]))
326327 cmds .append (f"--line-filter={ json .dumps ([line_ranges ])} " )
@@ -405,16 +406,13 @@ def create_comment_body(
405406 if CLANG_TIDY_STDOUT .exists () and CLANG_TIDY_STDOUT .stat ().st_size :
406407 parse_tidy_output () # get clang-tidy fixes from stdout
407408 comment_output = ""
408- if Globals .PAYLOAD_TIDY :
409- Globals .PAYLOAD_TIDY += "<hr></details>"
410409 for fix in GlobalParser .tidy_notes :
411410 if lines_changed_only and fix .line not in ranges :
412411 continue
413412 comment_output += repr (fix )
414413 tidy_notes .append (fix )
415414 if comment_output :
416- Globals .PAYLOAD_TIDY += f"<details><summary>{ filename } </summary><br>\n "
417- Globals .PAYLOAD_TIDY += comment_output
415+ Globals .TIDY_COMMENT += f"- { filename } \n \n { comment_output } "
418416 GlobalParser .tidy_notes .clear () # empty list to avoid duplicated output
419417
420418 if CLANG_FORMAT_XML .exists () and CLANG_FORMAT_XML .stat ().st_size :
@@ -430,10 +428,7 @@ def create_comment_body(
430428 should_comment = True
431429 break
432430 if should_comment :
433- if not Globals .OUTPUT :
434- Globals .OUTPUT = "<!-- cpp linter action -->\n ## :scroll: "
435- Globals .OUTPUT += "Run `clang-format` on the following files\n "
436- Globals .OUTPUT += f"- [ ] { file_obj ['filename' ]} \n "
431+ Globals .FORMAT_COMMENT += f"- { file_obj ['filename' ]} \n "
437432
438433
439434def capture_clang_tools_output (
@@ -480,13 +475,25 @@ def capture_clang_tools_output(
480475
481476 create_comment_body (filename , file , lines_changed_only , tidy_notes )
482477
483- if Globals .PAYLOAD_TIDY :
484- if not Globals .OUTPUT :
485- Globals .OUTPUT = "<!-- cpp linter action -->\n "
486- else :
487- Globals .OUTPUT += "\n ---\n "
488- Globals .OUTPUT += "## :speech_balloon: Output from `clang-tidy`\n "
489- Globals .OUTPUT += Globals .PAYLOAD_TIDY
478+ if Globals .FORMAT_COMMENT or Globals .TIDY_COMMENT :
479+ Globals .OUTPUT += ":warning:\n Some files did not pass the configured checks!\n "
480+ if Globals .FORMAT_COMMENT :
481+ Globals .OUTPUT += (
482+ "\n <details><summary>clang-format reports: <strong>"
483+ + f"{ len (GlobalParser .format_advice )} file(s) not formatted</strong>"
484+ + f"</summary>\n \n { Globals .FORMAT_COMMENT } \n \n </details>"
485+ )
486+ if Globals .TIDY_COMMENT :
487+ Globals .OUTPUT += (
488+ f"\n <details><summary>clang-tidy reports: <strong>{ len (tidy_notes )} "
489+ + f"concern(s)</strong></summary>\n \n { Globals .TIDY_COMMENT } \n \n "
490+ + "</details>"
491+ )
492+ else :
493+ Globals .OUTPUT += ":heavy_check_mark:\n No problems need attention."
494+ Globals .OUTPUT += "\n \n Have any feedback or feature suggestions? [Share it here.]"
495+ Globals .OUTPUT += "(https://github.com/cpp-linter/cpp-linter-action/issues)"
496+
490497 GlobalParser .tidy_notes = tidy_notes [:] # restore cache of notifications
491498
492499
@@ -814,6 +821,9 @@ def main():
814821 )
815822 if args .thread_comments and thread_comments_allowed :
816823 post_results (False ) # False is hard-coded to disable diff comments.
824+ if args .step_summary and "GITHUB_STEP_SUMMARY" in os .environ :
825+ with open (os .environ ["GITHUB_STEP_SUMMARY" ], "a" , encoding = "utf-8" ) as summary :
826+ summary .write (f"\n { Globals .OUTPUT } \n " )
817827 set_exit_code (
818828 int (
819829 make_annotations (args .style , args .file_annotations , args .lines_changed_only )
0 commit comments