feat: option to remove submitter in issue title

This commit is contained in:
张泊明518370910136 2024-10-30 17:49:20 -04:00
parent 8fa74e71d8
commit 0ad1e9540a
GPG Key ID: CA088E6D9284F870
2 changed files with 8 additions and 0 deletions

View File

@ -475,6 +475,10 @@ def joj3_all(
False,
help="skip creating failed table on gitea",
),
submitter_in_issue_title: bool = Option(
True,
help="whether to include submitter in issue title",
),
) -> None:
set_settings(Settings(_env_file=env_path))
set_logger(settings.stderr_log_level, diagnose=False, backtrace=False)
@ -497,6 +501,7 @@ def joj3_all(
exercise_name,
submitter,
commit_hash,
submitter_in_issue_title,
)
title_prefix = joj3.get_title_prefix(title)
joj3_issue: focs_gitea.Issue

View File

@ -186,6 +186,7 @@ def generate_title_and_comment(
exercise_name: str,
submitter: str,
commit_hash: str,
submitter_in_title: bool = True,
) -> Tuple[str, str]:
with open(score_file_path) as json_file:
stages: List[Dict[str, Any]] = json.load(json_file)
@ -225,6 +226,8 @@ def generate_title_and_comment(
total_score += result["score"]
comment += "\n"
title = f"JOJ3 Result for {exercise_name} by @{submitter} - Score: {total_score}"
if not submitter_in_title:
title = f"JOJ3 Result for {exercise_name} - Score: {total_score}"
return title, comment