Skip to content

Commit 6408b99

Browse files
committed
fix: ensure innersource_report.md is consistently used and tested
Signed-off-by: Zack Koppert <zkoppert@github.com>
1 parent f1ee538 commit 6408b99

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ def get_env_vars(test: bool = False) -> EnvVars:
154154
owner, repo = repository.split("/", 1)
155155

156156
report_title = os.getenv("REPORT_TITLE", "InnerSource Report")
157-
output_file = os.getenv("OUTPUT_FILE", "InnerSource_Report.md")
157+
output_file = os.getenv("OUTPUT_FILE")
158+
if not output_file:
159+
output_file = "innersource_report.md"
158160
rate_limit_bypass = get_bool_env_var("RATE_LIMIT_BYPASS", False)
159161

160162
return EnvVars(

test_config.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_get_env_vars_with_github_app(self):
105105
report_title="",
106106
owner="test_owner",
107107
repo="test_repo",
108-
output_file="",
108+
output_file="innersource_report.md",
109109
)
110110
result = get_env_vars(True)
111111
self.assertEqual(str(result), str(expected_result))
@@ -136,7 +136,7 @@ def test_get_env_vars_with_token(self):
136136
report_title="",
137137
owner="test_owner",
138138
repo="test_repo",
139-
output_file="",
139+
output_file="innersource_report.md",
140140
)
141141
result = get_env_vars(True)
142142
self.assertEqual(str(result), str(expected_result))
@@ -257,17 +257,13 @@ def test_get_env_vars_output_file_default_in_prod(self):
257257
{
258258
"REPOSITORY": "test_owner/test_repo",
259259
"GH_TOKEN": "TOKEN",
260-
"OUTPUT_FILE": "",
261260
},
262261
):
263262
# Verify the default value logic directly
264-
output_file = os.getenv("OUTPUT_FILE", "")
265-
self.assertEqual(output_file, "")
263+
env_vars = get_env_vars(test=True)
266264

267265
# This is the condition in get_env_vars
268-
if not output_file:
269-
output_file = "InnerSource_Report.md"
270-
self.assertEqual(output_file, "InnerSource_Report.md")
266+
self.assertEqual(env_vars.output_file, "innersource_report.md")
271267

272268
@patch.dict(
273269
os.environ,
@@ -293,7 +289,7 @@ def test_get_env_vars_optionals_are_defaulted(self):
293289
report_title="InnerSource Report",
294290
owner="test_owner",
295291
repo="test_repo",
296-
output_file="",
292+
output_file="innersource_report.md",
297293
rate_limit_bypass=False,
298294
)
299295
result = get_env_vars(True)

0 commit comments

Comments
 (0)