forked from JOJ/Joint-Teapot
		
	feat: load score file from env var
This commit is contained in:
		
							parent
							
								
									c8d6c10409
								
							
						
					
					
						commit
						1430b11e45
					
				|  | @ -649,9 +649,6 @@ def joj3_all( | |||
| ) | ||||
| def joj3_all_env( | ||||
|     env_path: str = Argument("", help="path to .env file"), | ||||
|     score_file_path: str = Argument( | ||||
|         "", help="path to score json file generated by JOJ3" | ||||
|     ), | ||||
|     grading_repo_name: str = Argument( | ||||
|         "", | ||||
|         help="name of grading repo to push failed table file", | ||||
|  | @ -704,6 +701,7 @@ def joj3_all_env( | |||
|     groups = os.getenv("JOJ3_GROUPS", "") | ||||
|     commit_msg = os.getenv("JOJ3_COMMIT_MSG", "") | ||||
|     force_quit_stage_name = os.getenv("JOJ3_FORCE_QUIT_STAGE_NAME") or "" | ||||
|     score_file_path = os.getenv("JOJ3_OUTPUT_PATH", "") | ||||
|     submitter_repo_name = (repository or "").split("/")[-1] | ||||
|     total_score = joj3.get_total_score(score_file_path) | ||||
|     res = { | ||||
|  | @ -772,7 +770,7 @@ def joj3_all_env( | |||
|     if skip_scoreboard and skip_failed_table: | ||||
|         return | ||||
|     lock_file_path = os.path.join( | ||||
|         settings.repos_dir, submitter_repo_name, settings.joj3_lock_file_path | ||||
|         settings.repos_dir, grading_repo_name, settings.joj3_lock_file_path | ||||
|     ) | ||||
|     logger.info( | ||||
|         f"try to acquire lock, file path: {lock_file_path}, " | ||||
|  | @ -784,12 +782,12 @@ def joj3_all_env( | |||
|         git_push_ok = False | ||||
|         while not git_push_ok: | ||||
|             repo_path = tea.pot.git.repo_clean_and_checkout( | ||||
|                 submitter_repo_name, | ||||
|                 grading_repo_name, | ||||
|                 "grading", | ||||
|                 clean_git_lock=True, | ||||
|                 reset_target="origin/grading", | ||||
|             ) | ||||
|             repo: Repo = tea.pot.git.get_repo(submitter_repo_name) | ||||
|             repo: Repo = tea.pot.git.get_repo(grading_repo_name) | ||||
|             if "grading" not in repo.remote().refs: | ||||
|                 logger.error( | ||||
|                     '"grading" branch not found in remote, create and push it to origin first.' | ||||
|  | @ -807,7 +805,7 @@ def joj3_all_env( | |||
|                     exercise_name, | ||||
|                 ) | ||||
|                 tea.pot.git.add_commit( | ||||
|                     submitter_repo_name, | ||||
|                     grading_repo_name, | ||||
|                     [scoreboard_file_name], | ||||
|                     ( | ||||
|                         f"joj3: update scoreboard for {exercise_name} by @{submitter} in " | ||||
|  | @ -826,7 +824,7 @@ def joj3_all_env( | |||
|                     gitea_actions_url, | ||||
|                 ) | ||||
|                 tea.pot.git.add_commit( | ||||
|                     submitter_repo_name, | ||||
|                     grading_repo_name, | ||||
|                     [failed_table_file_name], | ||||
|                     ( | ||||
|                         f"joj3: update failed table for {exercise_name} by @{submitter} in " | ||||
|  | @ -836,7 +834,7 @@ def joj3_all_env( | |||
|                         f"groups: {groups}\n" | ||||
|                     ), | ||||
|                 ) | ||||
|             push_info_list = tea.pot.git.push(submitter_repo_name) | ||||
|             push_info_list = tea.pot.git.push(grading_repo_name) | ||||
|             git_push_ok = push_info_list.error is None | ||||
|             if not git_push_ok: | ||||
|                 retry_interval *= 2 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user