Skip to content

feat: consider GH_ENTERPRISE_URL env in markdown author URL #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2025
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy