Skip to content

Commit c6f90db

Browse files
authored
Merge pull request #405 from github/fix-no-result-report-formatting
fix: pass through report name, issue title, and search query when report is empty
2 parents 6593a96 + 747f7e0 commit c6f90db

File tree

3 files changed

+49
-11
lines changed

3 files changed

+49
-11
lines changed

Diff for: issue_metrics.py

+34-2
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,47 @@ def main(): # pragma: no cover
368368
issues = get_discussions(token, search_query)
369369
if len(issues) <= 0:
370370
print("No discussions found")
371-
write_to_markdown(None, None, None, None, None, None, None, None)
371+
write_to_markdown(
372+
issues_with_metrics=None,
373+
average_time_to_first_response=None,
374+
average_time_to_close=None,
375+
average_time_to_answer=None,
376+
average_time_in_labels=None,
377+
num_issues_opened=None,
378+
num_issues_closed=None,
379+
num_mentor_count=None,
380+
labels=None,
381+
search_query=search_query,
382+
hide_label_metrics=False,
383+
hide_items_closed_count=False,
384+
non_mentioning_links=False,
385+
report_title=report_title,
386+
output_file=output_file,
387+
)
372388
return
373389
else:
374390
issues = search_issues(
375391
search_query, github_connection, owners_and_repositories, rate_limit_bypass
376392
)
377393
if len(issues) <= 0:
378394
print("No issues found")
379-
write_to_markdown(None, None, None, None, None, None, None, None)
395+
write_to_markdown(
396+
issues_with_metrics=None,
397+
average_time_to_first_response=None,
398+
average_time_to_close=None,
399+
average_time_to_answer=None,
400+
average_time_in_labels=None,
401+
num_issues_opened=None,
402+
num_issues_closed=None,
403+
num_mentor_count=None,
404+
labels=None,
405+
search_query=search_query,
406+
hide_label_metrics=False,
407+
hide_items_closed_count=False,
408+
non_mentioning_links=False,
409+
report_title=report_title,
410+
output_file=output_file,
411+
)
380412
return
381413

382414
# Get all the metrics

Diff for: markdown_writer.py

+15-8
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@
77
88
Functions:
99
write_to_markdown(
10-
issues_with_metrics: List[IssueWithMetrics],
11-
average_time_to_first_response: timedelta,
12-
average_time_to_close: timedelta,
13-
average_time_to_answer: timedelta,
14-
num_issues_opened: int,
15-
num_issues_closed: int,
16-
num_mentor_count: int,
17-
file: file object = None
10+
issues_with_metrics: Union[List[IssueWithMetrics], None],
11+
average_time_to_first_response: Union[dict[str, timedelta], None],
12+
average_time_to_close: Union[dict[str, timedelta], None],
13+
average_time_to_answer: Union[dict[str, timedelta], None],
14+
average_time_in_labels: Union[dict, None],
15+
num_issues_opened: Union[int, None],
16+
num_issues_closed: Union[int, None],
17+
num_mentor_count: Union[int, None],
18+
labels: List[str],
19+
search_query: str,
20+
hide_label_metrics: bool,
21+
hide_items_closed_count: bool,
22+
non_mentioning_links: bool,
23+
report_title: str,
24+
output_file: str,
1825
) -> None:
1926
Write the issues with metrics to a markdown file.
2027
get_non_hidden_columns(

Diff for: test_issue_metrics.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
TestSearchIssues: A class to test the search_issues function.
99
TestGetPerIssueMetrics: A class to test the get_per_issue_metrics function.
1010
TestGetEnvVars: A class to test the get_env_vars function.
11-
TestMain: A class to test the main function.
1211
1312
"""
1413

0 commit comments

Comments
 (0)