Skip to content

Commit

Permalink
Merge pull request #405 from github/fix-no-result-report-formatting
Browse files Browse the repository at this point in the history
fix: pass through report name, issue title, and search query when report is empty
  • Loading branch information
zkoppert authored Oct 16, 2024
2 parents 6593a96 + 747f7e0 commit c6f90db
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
36 changes: 34 additions & 2 deletions issue_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,47 @@ def main(): # pragma: no cover
issues = get_discussions(token, search_query)
if len(issues) <= 0:
print("No discussions found")
write_to_markdown(None, None, None, None, None, None, None, None)
write_to_markdown(
issues_with_metrics=None,
average_time_to_first_response=None,
average_time_to_close=None,
average_time_to_answer=None,
average_time_in_labels=None,
num_issues_opened=None,
num_issues_closed=None,
num_mentor_count=None,
labels=None,
search_query=search_query,
hide_label_metrics=False,
hide_items_closed_count=False,
non_mentioning_links=False,
report_title=report_title,
output_file=output_file,
)
return
else:
issues = search_issues(
search_query, github_connection, owners_and_repositories, rate_limit_bypass
)
if len(issues) <= 0:
print("No issues found")
write_to_markdown(None, None, None, None, None, None, None, None)
write_to_markdown(
issues_with_metrics=None,
average_time_to_first_response=None,
average_time_to_close=None,
average_time_to_answer=None,
average_time_in_labels=None,
num_issues_opened=None,
num_issues_closed=None,
num_mentor_count=None,
labels=None,
search_query=search_query,
hide_label_metrics=False,
hide_items_closed_count=False,
non_mentioning_links=False,
report_title=report_title,
output_file=output_file,
)
return

# Get all the metrics
Expand Down
23 changes: 15 additions & 8 deletions markdown_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@
Functions:
write_to_markdown(
issues_with_metrics: List[IssueWithMetrics],
average_time_to_first_response: timedelta,
average_time_to_close: timedelta,
average_time_to_answer: timedelta,
num_issues_opened: int,
num_issues_closed: int,
num_mentor_count: int,
file: file object = None
issues_with_metrics: Union[List[IssueWithMetrics], None],
average_time_to_first_response: Union[dict[str, timedelta], None],
average_time_to_close: Union[dict[str, timedelta], None],
average_time_to_answer: Union[dict[str, timedelta], None],
average_time_in_labels: Union[dict, None],
num_issues_opened: Union[int, None],
num_issues_closed: Union[int, None],
num_mentor_count: Union[int, None],
labels: List[str],
search_query: str,
hide_label_metrics: bool,
hide_items_closed_count: bool,
non_mentioning_links: bool,
report_title: str,
output_file: str,
) -> None:
Write the issues with metrics to a markdown file.
get_non_hidden_columns(
Expand Down
1 change: 0 additions & 1 deletion test_issue_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
TestSearchIssues: A class to test the search_issues function.
TestGetPerIssueMetrics: A class to test the get_per_issue_metrics function.
TestGetEnvVars: A class to test the get_env_vars function.
TestMain: A class to test the main function.
"""

Expand Down

0 comments on commit c6f90db

Please sign in to comment.