Skip to content

Commit 0bac475

Browse files
authored
Merge pull request #516 from jonasbreuer/ghe-author-link
feat: consider GH_ENTERPRISE_URL env in markdown author URL
2 parents bf0268f + 5477ea4 commit 0bac475

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

issue_metrics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ def main(): # pragma: no cover
284284
non_mentioning_links=False,
285285
report_title=report_title,
286286
output_file=output_file,
287+
ghe=ghe,
287288
)
288289
return
289290
else:
@@ -309,6 +310,7 @@ def main(): # pragma: no cover
309310
non_mentioning_links=False,
310311
report_title=report_title,
311312
output_file=output_file,
313+
ghe=ghe,
312314
)
313315
return
314316

@@ -371,6 +373,7 @@ def main(): # pragma: no cover
371373
non_mentioning_links=non_mentioning_links,
372374
report_title=report_title,
373375
output_file=output_file,
376+
ghe=ghe,
374377
)
375378

376379
evaluate_markdown_file_size(output_file)

test_markdown_writer.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,15 @@ def test_write_to_markdown_no_issues(self):
298298
"HIDE_TIME_TO_ANSWER": "True",
299299
"HIDE_LABEL_METRICS": "True",
300300
"NON_MENTIONING_LINKS": "True",
301+
"GH_ENTERPRISE_URL": "https://ghe.com",
301302
},
302303
)
303304
class TestWriteToMarkdownWithEnv(unittest.TestCase):
304-
"""Test the write_to_markdown function with the HIDE* and NON_MENTIONING_LINKS environment variables set."""
305+
"""Test the write_to_markdown function with the following environment variables set:
306+
- HIDE*,
307+
- NON_MENTIONING_LINKS
308+
- GH_ENTERPRISE_URL
309+
"""
305310

306311
def test_writes_markdown_file_with_non_hidden_columns_only(self):
307312
"""
@@ -313,7 +318,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
313318
issues_with_metrics = [
314319
IssueWithMetrics(
315320
title="Issue 1",
316-
html_url="https://github.com/user/repo/issues/1",
321+
html_url="https://ghe.com/user/repo/issues/1",
317322
author="alice",
318323
created_at=timedelta(days=-5),
319324
time_to_first_response=timedelta(minutes=10),
@@ -326,7 +331,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
326331
),
327332
IssueWithMetrics(
328333
title="Issue 2",
329-
html_url="https://github.com/user/repo/issues/2",
334+
html_url="https://ghe.com/user/repo/issues/2",
330335
author="bob",
331336
created_at=timedelta(days=-5),
332337
time_to_first_response=timedelta(minutes=20),
@@ -347,6 +352,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
347352
num_issues_opened = 2
348353
num_issues_closed = 2
349354
num_mentor_count = 5
355+
ghe = "https://ghe.com"
350356

351357
# Call the function
352358
write_to_markdown(
@@ -366,6 +372,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
366372
non_mentioning_links=True,
367373
report_title="Issue Metrics",
368374
output_file="issue_metrics.md",
375+
ghe=ghe,
369376
)
370377

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

0 commit comments

Comments
 (0)