forked from JOJ/Joint-Teapot
		
	feat: joj3 comment show link to actions
This commit is contained in:
		
							parent
							
								
									0b50495d09
								
							
						
					
					
						commit
						e332c64221
					
				|  | @ -308,9 +308,18 @@ def joj3_create_result_issue( | ||||||
|         "", |         "", | ||||||
|         help="repository's name of the submitter", |         help="repository's name of the submitter", | ||||||
|     ), |     ), | ||||||
|  |     run_number: str = Argument( | ||||||
|  |         "", | ||||||
|  |         help="gitea actions run number", | ||||||
|  |     ), | ||||||
| ) -> None: | ) -> None: | ||||||
|     set_settings(Settings(_env_file=env_path)) |     set_settings(Settings(_env_file=env_path)) | ||||||
|     title, comment = joj3.generate_title_and_comment(scorefile_path) |     action_link = ( | ||||||
|  |         f"https://{settings.gitea_domain_name}{settings.gitea_suffix}/" | ||||||
|  |         + f"{settings.gitea_org_name}/{submitter_repo_name}/" | ||||||
|  |         + f"actions/runs/{run_number}" | ||||||
|  |     ) | ||||||
|  |     title, comment = joj3.generate_title_and_comment(scorefile_path, action_link) | ||||||
|     tea.pot.gitea.create_issue(submitter_repo_name, title, comment, False) |     tea.pot.gitea.create_issue(submitter_repo_name, title, comment, False) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -164,12 +164,14 @@ def generate_failed_table( | ||||||
|     write_failed_table_into_file(data, table_file_path) |     write_failed_table_into_file(data, table_file_path) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def generate_title_and_comment(score_file_path: str) -> Tuple[str, str]: | def generate_title_and_comment( | ||||||
|  |     score_file_path: str, action_link: str | ||||||
|  | ) -> Tuple[str, str]: | ||||||
|     with open(score_file_path) as json_file: |     with open(score_file_path) as json_file: | ||||||
|         stages: List[Dict[str, Any]] = json.load(json_file) |         stages: List[Dict[str, Any]] = json.load(json_file) | ||||||
| 
 | 
 | ||||||
|     total_score = 0 |     total_score = 0 | ||||||
|     comment = "" |     comment = f"[Gitea Actions]({action_link})\n" | ||||||
|     for stage in stages: |     for stage in stages: | ||||||
|         comment += f"## {stage['name']}\n" |         comment += f"## {stage['name']}\n" | ||||||
|         for i, result in enumerate(stage["results"]): |         for i, result in enumerate(stage["results"]): | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user