@@ -108,6 +108,20 @@ def add_job_summary() -> int:
108108 return 0 if result_text is None else 1
109109
110110
111+ def set_pr_comments_output () -> None :
112+ """Sets the pr_comments output regardless of PR_COMMENTS setting."""
113+ result_text = read_result_file ()
114+ pr_comments = (
115+ SUCCESS_TITLE
116+ if result_text is None
117+ else f"{ FAILURE_TITLE } \n ```\n { result_text } \n ```"
118+ )
119+
120+ # output pr_comments to $GITHUB_OUTPUT
121+ with open (os .environ ["GITHUB_OUTPUT" ], "a" , encoding = "utf-8" ) as output_file :
122+ output_file .write (f"pr_comments={ pr_comments } \n " )
123+
124+
111125def add_pr_comments () -> int :
112126 """Posts the commit check result as a comment on the pull request."""
113127 if PR_COMMENTS == "false" :
@@ -168,10 +182,6 @@ def add_pr_comments() -> int:
168182 print (f"Creating a new comment on PR #{ pr_number } ." )
169183 pull_request .create_comment (body = pr_comments )
170184
171- # output pr_comments to $GITHUB_OUTPUT
172- with open (os .environ ["GITHUB_OUTPUT" ], "a" , encoding = "utf-8" ) as output_file :
173- output_file .write (f"pr_comments={ pr_comments } \n " )
174-
175185 return 0 if result_text is None else 1
176186 except Exception as e :
177187 print (f"Error posting PR comment: { e } " , file = sys .stderr )
@@ -203,6 +213,9 @@ def main():
203213 ret_code = run_commit_check ()
204214 ret_code += add_job_summary ()
205215 ret_code += add_pr_comments ()
216+
217+ # Always set pr_comments output regardless of PR_COMMENTS setting
218+ set_pr_comments_output ()
206219
207220 if DRY_RUN == "true" :
208221 ret_code = 0
0 commit comments