Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions issue_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ def main(): # pragma: no cover
non_mentioning_links=False,
report_title=report_title,
output_file=output_file,
ghe=ghe,
)
return
else:
Expand All @@ -309,6 +310,7 @@ def main(): # pragma: no cover
non_mentioning_links=False,
report_title=report_title,
output_file=output_file,
ghe=ghe,
)
return

Expand Down Expand Up @@ -371,6 +373,7 @@ def main(): # pragma: no cover
non_mentioning_links=non_mentioning_links,
report_title=report_title,
output_file=output_file,
ghe=ghe,
)

evaluate_markdown_file_size(output_file)
Expand Down
17 changes: 12 additions & 5 deletions test_markdown_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,15 @@ def test_write_to_markdown_no_issues(self):
"HIDE_TIME_TO_ANSWER": "True",
"HIDE_LABEL_METRICS": "True",
"NON_MENTIONING_LINKS": "True",
"GH_ENTERPRISE_URL": "https://ghe.com",
},
)
class TestWriteToMarkdownWithEnv(unittest.TestCase):
"""Test the write_to_markdown function with the HIDE* and NON_MENTIONING_LINKS environment variables set."""
"""Test the write_to_markdown function with the following environment variables set:
- HIDE*,
- NON_MENTIONING_LINKS
- GH_ENTERPRISE_URL
"""

def test_writes_markdown_file_with_non_hidden_columns_only(self):
"""
Expand All @@ -313,7 +318,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
issues_with_metrics = [
IssueWithMetrics(
title="Issue 1",
html_url="https://github.com/user/repo/issues/1",
html_url="https://ghe.com/user/repo/issues/1",
author="alice",
created_at=timedelta(days=-5),
time_to_first_response=timedelta(minutes=10),
Expand All @@ -326,7 +331,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
),
IssueWithMetrics(
title="Issue 2",
html_url="https://github.com/user/repo/issues/2",
html_url="https://ghe.com/user/repo/issues/2",
author="bob",
created_at=timedelta(days=-5),
time_to_first_response=timedelta(minutes=20),
Expand All @@ -347,6 +352,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
num_issues_opened = 2
num_issues_closed = 2
num_mentor_count = 5
ghe = "https://ghe.com"

# Call the function
write_to_markdown(
Expand All @@ -366,6 +372,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
non_mentioning_links=True,
report_title="Issue Metrics",
output_file="issue_metrics.md",
ghe=ghe,
)

# Check that the function writes the correct markdown file
Expand All @@ -381,8 +388,8 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
"| Total number of items created | 2 |\n\n"
"| Title | URL | Author | Created At |\n"
"| --- | --- | --- | --- |\n"
"| Issue 1 | https://www.github.com/user/repo/issues/1 | [alice](https://github.com/alice) | -5 days, 0:00:00 |\n"
"| Issue 2 | https://www.github.com/user/repo/issues/2 | [bob](https://github.com/bob) | -5 days, 0:00:00 |\n\n"
"| Issue 1 | https://www.ghe.com/user/repo/issues/1 | [alice](https://ghe.com/alice) | -5 days, 0:00:00 |\n"
"| Issue 2 | https://www.ghe.com/user/repo/issues/2 | [bob](https://ghe.com/bob) | -5 days, 0:00:00 |\n\n"
"_This report was generated with the [Issue Metrics Action](https://github.com/github/issue-metrics)_\n"
"Search query used to find these items: `repo:user/repo is:issue`\n"
)
Expand Down
Loading