@@ -57,8 +57,11 @@ def get_pr_commit_messages() -> list[str]:
5757 return [
5858 m .rstrip ("\n " ) for m in result .stdout .split ("\x00 " ) if m .rstrip ("\n " )
5959 ]
60- except Exception :
61- pass
60+ except Exception as e :
61+ print (
62+ f"::warning::Failed to retrieve PR commit messages: { e } " ,
63+ file = sys .stderr ,
64+ )
6265 return []
6366
6467
@@ -74,9 +77,9 @@ def build_check_args(
7477def run_pr_message_checks (pr_messages : list [str ], result_file ) -> int : # type: ignore[type-arg]
7578 """Checks each PR commit message individually via commit-check --message.
7679
77- Returns cumulative returncode across all messages .
80+ Returns 1 if any message fails, 0 if all pass .
7881 """
79- total_rc = 0
82+ has_failure = False
8083 for msg in pr_messages :
8184 result = subprocess .run (
8285 ["commit-check" , "--message" ],
@@ -86,8 +89,8 @@ def run_pr_message_checks(pr_messages: list[str], result_file) -> int: # type:
8689 text = True ,
8790 check = False ,
8891 )
89- total_rc += result .returncode
90- return total_rc
92+ has_failure = has_failure or ( result .returncode != 0 )
93+ return 1 if has_failure else 0
9194
9295
9396def run_other_checks (args : list [str ], result_file ) -> int : # type: ignore[type-arg]
@@ -97,7 +100,7 @@ def run_other_checks(args: list[str], result_file) -> int: # type: ignore[type-
97100 command = ["commit-check" ] + args
98101 print (" " .join (command ))
99102 result = subprocess .run (
100- command , stdout = result_file , stderr = subprocess .PIPE , check = False
103+ command , stdout = result_file , stderr = subprocess .PIPE , text = True , check = False
101104 )
102105 return result .returncode
103106
@@ -107,7 +110,7 @@ def run_default_checks(args: list[str], result_file) -> int: # type: ignore[typ
107110 command = ["commit-check" ] + args
108111 print (" " .join (command ))
109112 result = subprocess .run (
110- command , stdout = result_file , stderr = subprocess .PIPE , check = False
113+ command , stdout = result_file , stderr = subprocess .PIPE , text = True , check = False
111114 )
112115 return result .returncode
113116
0 commit comments