@@ -122,12 +122,10 @@ def get_pr_info_from_number(pr_number: str) -> dict:
122122 return response .json ()
123123
124124
125- def get_run_details (run_url : str ) -> dict :
125+ def get_run_details (run_id : str ) -> dict :
126126 """
127127 Fetch run details for a given run URL.
128128 """
129- run_id = run_url .split ("/" )[- 1 ]
130-
131129 headers = {
132130 "Authorization" : f"token { GITHUB_TOKEN } " ,
133131 "Accept" : "application/vnd.github.v3+json" ,
@@ -732,7 +730,9 @@ def create_workflow_report(
732730 if not all ([host , user , password , GITHUB_TOKEN ]):
733731 raise Exception ("Required environment variables are not set" )
734732
735- run_details = get_run_details (actions_run_url )
733+ run_id = actions_run_url .split ("/" )[- 1 ]
734+
735+ run_details = get_run_details (run_id )
736736 branch_name = run_details .get ("head_branch" , "unknown branch" )
737737 if pr_number is None or commit_sha is None :
738738 if pr_number is None :
@@ -821,7 +821,7 @@ def create_workflow_report(
821821 "s3_bucket" : S3_BUCKET ,
822822 "pr_info_html" : pr_info_html ,
823823 "pr_number" : pr_number ,
824- "workflow_id" : actions_run_url . split ( "/" )[ - 1 ] ,
824+ "workflow_id" : run_id ,
825825 "commit_sha" : commit_sha ,
826826 "base_sha" : "" if pr_number == 0 else pr_info .get ("base" , {}).get ("sha" ),
827827 "date" : f"{ datetime .utcnow ().strftime ('%Y-%m-%d %H:%M:%S' )} UTC" ,
@@ -875,9 +875,11 @@ def create_workflow_report(
875875 exit (0 )
876876
877877 if pr_number == 0 :
878- report_destination_key = f"REFs/{ branch_name } /{ commit_sha } / { report_name } "
878+ report_destination_key = f"REFs/{ branch_name } /{ commit_sha } "
879879 else :
880- report_destination_key = f"PRs/{ pr_number } /{ commit_sha } /{ report_name } "
880+ report_destination_key = f"PRs/{ pr_number } /{ commit_sha } "
881+
882+ report_destination_key += f"/{ run_id } /{ report_name } "
881883
882884 # Upload the report to S3
883885 s3_client = boto3 .client ("s3" , endpoint_url = os .getenv ("S3_URL" ))
0 commit comments