77
88
99# Constants for message titles
10- SUCCESS_TITLE = "### Commit-Check ✔️\n "
11- FAILURE_TITLE = "### Commit-Check ❌\n "
10+ SUCCESS_TITLE = "# Commit-Check ✔️"
11+ FAILURE_TITLE = "# Commit-Check ❌"
1212
1313# Environment variables
1414MESSAGE = os .getenv ("MESSAGE" , "false" )
@@ -70,7 +70,7 @@ def read_result_file() -> str | None:
7070 result_text = re .sub (
7171 r"\x1B\[[0-9;]*[a-zA-Z]" , "" , result_file .read ()
7272 ) # Remove ANSI colors
73- return result_text
73+ return result_text . rstrip ()
7474 return None
7575
7676
@@ -84,7 +84,7 @@ def add_job_summary() -> int:
8484 summary_content = (
8585 SUCCESS_TITLE
8686 if result_text is None
87- else f"{ FAILURE_TITLE } ```\n { result_text } \n ```"
87+ else f"{ FAILURE_TITLE } \n ```\n { result_text } \n ```"
8888 )
8989
9090 with open (GITHUB_STEP_SUMMARY , "a" ) as summary_file :
@@ -113,7 +113,7 @@ def add_pr_comments() -> int:
113113 pr_comments = (
114114 SUCCESS_TITLE
115115 if result_text is None
116- else f"{ FAILURE_TITLE } ```\n { result_text } \n ```"
116+ else f"{ FAILURE_TITLE } \n ```\n { result_text } \n ```"
117117 )
118118
119119 # Fetch all existing comments on the PR
@@ -146,7 +146,7 @@ def add_pr_comments() -> int:
146146 else :
147147 # No matching comments, create a new one
148148 print (f"Creating a new comment on PR #{ pr_number } ." )
149- pull_request .create_issue_comment (body = pr_comments )
149+ pull_request .create_comment (body = pr_comments )
150150
151151 return 0 if result_text is None else 1
152152 except Exception as e :
0 commit comments