feat: failure link
This commit is contained in:
parent
9d4d4eb7fe
commit
d0192f37ef
|
@ -267,6 +267,10 @@ def joj3_failed_table(
|
|||
failed_table_file_name: str = Argument(
|
||||
"failed-table.md", help="name of failed table file in the gitea repo"
|
||||
),
|
||||
run_number: str = Argument(
|
||||
"",
|
||||
help="gitea actions run number",
|
||||
),
|
||||
) -> None:
|
||||
set_settings(Settings(_env_file=env_path))
|
||||
if joj3.check_skipped(score_file_path, "skip-failed-table"):
|
||||
|
@ -286,11 +290,17 @@ def joj3_failed_table(
|
|||
f"https://{settings.gitea_domain_name}{settings.gitea_suffix}/"
|
||||
+ f"{settings.gitea_org_name}/{submitter_repo_name}"
|
||||
)
|
||||
action_link = (
|
||||
f"https://{settings.gitea_domain_name}{settings.gitea_suffix}/"
|
||||
+ f"{settings.gitea_org_name}/{submitter_repo_name}/"
|
||||
+ f"actions/runs/{run_number}"
|
||||
)
|
||||
joj3.generate_failed_table(
|
||||
score_file_path,
|
||||
submitter_repo_name,
|
||||
submitter_repo_link,
|
||||
os.path.join(repo_path, failed_table_file_name),
|
||||
action_link,
|
||||
)
|
||||
tea.pot.git.add_commit_and_push(
|
||||
repo_name,
|
||||
|
|
|
@ -110,7 +110,11 @@ def get_failed_table_from_file(table_file_path: str) -> List[List[str]]:
|
|||
|
||||
|
||||
def update_failed_table_from_score_file(
|
||||
data: List[List[str]], score_file_path: str, repo_name: str, repo_link: str
|
||||
data: List[List[str]],
|
||||
score_file_path: str,
|
||||
repo_name: str,
|
||||
repo_link: str,
|
||||
action_link: str,
|
||||
) -> None:
|
||||
# get info from score file
|
||||
with open(score_file_path) as json_file:
|
||||
|
@ -125,7 +129,7 @@ def update_failed_table_from_score_file(
|
|||
# append to failed table
|
||||
now = datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
repo = f"[{repo_name}]({repo_link})"
|
||||
failure = f"[{failed_name}]({'#'})" # TODO: Update failure link
|
||||
failure = f"[{failed_name}]({action_link})"
|
||||
row_found = False
|
||||
for i, row in enumerate(data[:]):
|
||||
if row[1] == repo:
|
||||
|
@ -152,7 +156,11 @@ def write_failed_table_into_file(data: List[List[str]], table_file_path: str) ->
|
|||
|
||||
|
||||
def generate_failed_table(
|
||||
score_file_path: str, repo_name: str, repo_link: str, table_file_path: str
|
||||
score_file_path: str,
|
||||
repo_name: str,
|
||||
repo_link: str,
|
||||
table_file_path: str,
|
||||
action_link: str,
|
||||
) -> None:
|
||||
if not table_file_path.endswith(".md"):
|
||||
logger.error(
|
||||
|
@ -161,7 +169,13 @@ def generate_failed_table(
|
|||
return
|
||||
|
||||
data = get_failed_table_from_file(table_file_path)
|
||||
update_failed_table_from_score_file(data, score_file_path, repo_name, repo_link)
|
||||
update_failed_table_from_score_file(
|
||||
data,
|
||||
score_file_path,
|
||||
repo_name,
|
||||
repo_link,
|
||||
action_link,
|
||||
)
|
||||
write_failed_table_into_file(data, table_file_path)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user