feat: joj3 re-use issue

This commit is contained in:
张泊明518370910136 2024-10-27 11:14:26 -04:00
parent 0e292bb6bd
commit f85b20e197
GPG Key ID: CA088E6D9284F870
2 changed files with 28 additions and 5 deletions

View File

@ -498,13 +498,29 @@ def joj3_all(
submitter, submitter,
commit_hash, commit_hash,
) )
issue: focs_gitea.Issue = tea.pot.gitea.issue_api.issue_create_issue( title_prefix = joj3.get_title_prefix(title)
tea.pot.gitea.org_name, joj3_issue: focs_gitea.Issue
submitter_repo_name, issue: focs_gitea.Issue
body={"title": title, "body": comment}, for issue in tea.pot.gitea.issue_api.issue_list_issues(
) tea.pot.gitea.org_name, submitter_repo_name, state="all"
):
if issue.title.startswith(title_prefix):
joj3_issue = issue
break
else:
joj3_issue = tea.pot.gitea.issue_api.issue_create_issue(
tea.pot.gitea.org_name,
submitter_repo_name,
body={"title": title, "body": ""},
)
gitea_issue_url = issue.html_url gitea_issue_url = issue.html_url
logger.info(f"gitea issue url: {gitea_issue_url}") logger.info(f"gitea issue url: {gitea_issue_url}")
tea.pot.gitea.issue_api.issue_edit_issue(
tea.pot.gitea.org_name,
submitter_repo_name,
joj3_issue.number,
body={"body": comment},
)
if skip_scoreboard and skip_failed_table: if skip_scoreboard and skip_failed_table:
return return
tea.pot.git # trigger lazy load tea.pot.git # trigger lazy load

View File

@ -237,3 +237,10 @@ def check_skipped(score_file_path: str, keyword: str) -> bool:
if keyword in comment or "skip-teapot" in comment: if keyword in comment or "skip-teapot" in comment:
return True return True
return False return False
def get_title_prefix(title: str) -> str:
for i in range(len(title) - 1, -1, -1):
if not title[i].isdigit() and not title[i].isspace():
return title[: i + 1]
return ""