Skip to content

Commit 2b558c4

Browse files
committed
fix: move None guard above yaml.dump to avoid writing null to debug file
## What Moved the `if dependabot_file is None` check above the `yaml.dump()` call in `main()` so that None results skip immediately without writing `null` to `dependabot-output.yaml`. ## Why The previous ordering called `yaml.dump(None, yaml_file)` before checking for None, writing a `null` YAML literal to the debug artifact. This was a pre-existing issue for the "no package managers" path, but the YAML error handling change made it newly reachable via the error path. ## Notes - The YAML object and stream setup also moved below the guard since they're only needed when dependabot_file is not None. Signed-off-by: jmeridth <jmeridth@gmail.com>
1 parent 3bd6225 commit 2b558c4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

evergreen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ def main(): # pragma: no cover
178178
cooldown,
179179
)
180180

181+
if dependabot_file is None:
182+
print("\tNo (new) compatible package manager found")
183+
continue
184+
181185
yaml = ruamel.yaml.YAML()
182186
stream = io.StringIO()
183187
yaml.indent(mapping=2, sequence=4, offset=2)
@@ -186,10 +190,6 @@ def main(): # pragma: no cover
186190
with open("dependabot-output.yaml", "w", encoding="utf-8") as yaml_file:
187191
yaml.dump(dependabot_file, yaml_file)
188192

189-
if dependabot_file is None:
190-
print("\tNo (new) compatible package manager found")
191-
continue
192-
193193
dependabot_file = yaml.dump(dependabot_file, stream)
194194
dependabot_file = stream.getvalue()
195195

0 commit comments

Comments
 (0)