Skip to content

Commit 0a41710

Browse files
fix: markdown endpoint
1 parent b153307 commit 0a41710

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

contributors.py

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def main():
8282
repository_list,
8383
sponsor_info,
8484
link_to_profile,
85+
ghe,
8586
)
8687
json_writer.write_to_json(
8788
filename="contributors.json",

markdown.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def write_to_markdown(
1111
repository,
1212
sponsor_info,
1313
link_to_profile,
14+
ghe,
1415
):
1516
"""
1617
This function writes a list of collaborators to a markdown file in table format.
@@ -40,6 +41,7 @@ def write_to_markdown(
4041
repository,
4142
sponsor_info,
4243
link_to_profile,
44+
ghe,
4345
)
4446

4547
# Put together the summary table including # of new contributions, # of new contributors, % new contributors, % returning contributors
@@ -134,6 +136,7 @@ def get_contributor_table(
134136
repository,
135137
sponsor_info,
136138
link_to_profile,
139+
ghe,
137140
):
138141
"""
139142
This function returns a string containing a markdown table of the contributors and the total contribution count.
@@ -182,7 +185,10 @@ def get_contributor_table(
182185
for url in commit_url_list:
183186
url = url.strip()
184187
# get the organization and repository name from the url ie. org1/repo2 from https://github.com/org1/repo2/commits?author-zkoppert
185-
org_repo_link_name = url.split("/commits")[0].split("github.com/")[1]
188+
api_endpoint = ghe.removeprefix("https://") if ghe else "github.com"
189+
org_repo_link_name = url.split("/commits")[0].split(f"{api_endpoint}/")[
190+
1
191+
]
186192
url = f"[{org_repo_link_name}]({url})"
187193
commit_urls += f"{url}, "
188194
new_contributor = collaborator.new_contributor

test_markdown.py

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def test_write_to_markdown(self, mock_file):
3939
person1,
4040
person2,
4141
]
42+
ghe = ""
4243

4344
write_to_markdown(
4445
collaborators,
@@ -49,6 +50,7 @@ def test_write_to_markdown(self, mock_file):
4950
"org/repo",
5051
"false",
5152
"true",
53+
ghe,
5254
)
5355

5456
mock_file.assert_called_once_with("filename", "w", encoding="utf-8")
@@ -93,6 +95,7 @@ def test_write_to_markdown_with_sponsors(self, mock_file):
9395
person1,
9496
person2,
9597
]
98+
ghe = ""
9699

97100
write_to_markdown(
98101
collaborators,
@@ -103,6 +106,7 @@ def test_write_to_markdown_with_sponsors(self, mock_file):
103106
"org/repo",
104107
"true",
105108
"true",
109+
ghe,
106110
)
107111

108112
mock_file.assert_called_once_with("filename", "w", encoding="utf-8")
@@ -147,6 +151,7 @@ def test_write_to_markdown_without_link_to_profile(self, mock_file):
147151
person1,
148152
person2,
149153
]
154+
ghe = ""
150155

151156
write_to_markdown(
152157
collaborators,
@@ -157,6 +162,7 @@ def test_write_to_markdown_without_link_to_profile(self, mock_file):
157162
"org/repo",
158163
"false",
159164
"false",
165+
ghe,
160166
)
161167

162168
mock_file.assert_called_once_with("filename", "w", encoding="utf-8")

0 commit comments

Comments
 (0)