Skip to content

Commit d9dc177

Browse files
authored
Merge pull request #177 from github/header-fix
fix: header seperator count
2 parents e8fd82d + 1ec6d4e commit d9dc177

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

stale_repos.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,12 @@ def write_to_markdown(
250250
markdown_file.write(" Days Since Last Release |")
251251
if "pr" in additional_metrics:
252252
markdown_file.write(" Days Since Last PR |")
253-
markdown_file.write("\n| --- | --- | --- | ---: |")
254-
if additional_metrics and (
255-
"release" in additional_metrics or "pr" in additional_metrics
256-
):
257-
markdown_file.write(" ---: |")
253+
markdown_file.write("\n| --- | --- | --- | --- |")
254+
if additional_metrics:
255+
if "release" in additional_metrics:
256+
markdown_file.write(" --- |")
257+
if "pr" in additional_metrics:
258+
markdown_file.write(" --- |")
258259
markdown_file.write("\n")
259260
for repo_data in inactive_repos:
260261
markdown_file.write(

test_stale_repos.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,16 @@ def test_write_to_markdown(self):
576576
"days_inactive": 30,
577577
"last_push_date": thirty_days_ago.date().isoformat(),
578578
"visibility": "private",
579+
"days_since_last_release": None,
580+
"days_since_last_pr": None,
579581
},
580582
{
581583
"url": "https://github.com/example/repo2",
582584
"days_inactive": 40,
583585
"last_push_date": forty_days_ago.date().isoformat(),
584586
"visibility": "public",
587+
"days_since_last_release": None,
588+
"days_since_last_pr": None,
585589
},
586590
]
587591

@@ -591,7 +595,12 @@ def test_write_to_markdown(self):
591595
mock_file = MagicMock()
592596

593597
# Call the write_to_markdown function with the mock file object
594-
write_to_markdown(inactive_repos, inactive_days_threshold, file=mock_file)
598+
write_to_markdown(
599+
inactive_repos,
600+
inactive_days_threshold,
601+
additional_metrics=["release", "pr"],
602+
file=mock_file,
603+
)
595604

596605
# Check that the mock file object was called with the expected data
597606
expected_calls = [
@@ -602,17 +611,25 @@ def test_write_to_markdown(self):
602611
call.write(
603612
"| Repository URL | Days Inactive | Last Push Date | Visibility |"
604613
),
605-
call.write("\n| --- | --- | --- | ---: |"),
614+
call.write(" Days Since Last Release |"),
615+
call.write(" Days Since Last PR |"),
616+
call.write("\n| --- | --- | --- | --- |"),
617+
call.write(" --- |"),
618+
call.write(" --- |"),
606619
call.write("\n"),
607620
call.write(
608621
f"| https://github.com/example/repo2 | 40 |\
609622
{forty_days_ago.date().isoformat()} | public |"
610623
),
624+
call.write(" None |"),
625+
call.write(" None |"),
611626
call.write("\n"),
612627
call.write(
613628
f"| https://github.com/example/repo1 | 30 |\
614629
{thirty_days_ago.date().isoformat()} | private |"
615630
),
631+
call.write(" None |"),
632+
call.write(" None |"),
616633
call.write("\n"),
617634
]
618635
mock_file.__enter__.return_value.assert_has_calls(expected_calls)

0 commit comments

Comments
 (0)