diff --git a/issue_metrics.py b/issue_metrics.py index ff3c6ca..a1b3f11 100644 --- a/issue_metrics.py +++ b/issue_metrics.py @@ -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: @@ -309,6 +310,7 @@ def main(): # pragma: no cover non_mentioning_links=False, report_title=report_title, output_file=output_file, + ghe=ghe, ) return @@ -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) diff --git a/test_markdown_writer.py b/test_markdown_writer.py index 1d63db5..3927106 100644 --- a/test_markdown_writer.py +++ b/test_markdown_writer.py @@ -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): """ @@ -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), @@ -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), @@ -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( @@ -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 @@ -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" )