@@ -109,27 +109,38 @@ def main():
109109 parser = argparse .ArgumentParser (description = "Post SonarQube results to GitHub PR" )
110110 parser .add_argument ("--github_token" , required = True , help = "GitHub access token" )
111111 parser .add_argument ("--repo_owner" , default = "SiliconLabsSoftware" , help = "GitHub repository owner" )
112- parser .add_argument ("--repo_name" , default = "matter_extension " , help = "GitHub repository name" )
112+ parser .add_argument ("--repo_name" , default = "matter_sdk " , help = "GitHub repository name" )
113113 parser .add_argument ("--pr_number" , required = True , help = "Pull request number" )
114114 parser .add_argument ("--commit_sha" , required = True , help = "Git commit SHA" )
115115 parser .add_argument ("--result" , required = True , choices = ["PASS" , "FAIL" ], help = "SonarQube analysis result" )
116116 parser .add_argument ("--status" , required = True , help = "SonarQube quality gate status" )
117117
118118 parser .add_argument ("--branch_name" , required = True , help = "Source branch name" )
119119 parser .add_argument ("--target_branch" , required = True , help = "Target branch name" )
120- parser .add_argument ("--sonar_output " , required = True , help = "SonarQube scanner output" )
120+ parser .add_argument ("--sonar_output_file " , required = True , help = "Path to file containing SonarQube scanner output" )
121121
122122 args = parser .parse_args ()
123123
124124 try :
125+ # Read SonarQube output from file
126+ try :
127+ with open (args .sonar_output_file , 'r' , encoding = 'utf-8' ) as f :
128+ sonar_output = f .read ()
129+ except FileNotFoundError :
130+ print (f"❌ Error: SonarQube output file not found: { args .sonar_output_file } " )
131+ sys .exit (1 )
132+ except Exception as e :
133+ print (f"❌ Error reading SonarQube output file: { str (e )} " )
134+ sys .exit (1 )
135+
125136 # Create comment body
126137 comment_body = create_comment_body (
127138 args .result ,
128139 args .status ,
129140 args .commit_sha ,
130141 args .branch_name ,
131142 args .target_branch ,
132- args . sonar_output
143+ sonar_output
133144 )
134145
135146 # Post PR comment
0 commit comments