Skip to content

Commit

Permalink
Nuke old style dependabot config.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Mar 14, 2024
1 parent 881e26f commit 4b826dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
23 changes: 8 additions & 15 deletions repo_helper/files/bots.py
Expand Up @@ -140,24 +140,17 @@ def make_dependabot(repo_path: pathlib.Path, templates: Environment) -> List[str
"""

dependabot_file = PathPlus(repo_path / ".dependabot" / "config.yml")
dependabot_file.parent.maybe_make()
return_filename = dependabot_file.relative_to(repo_path).as_posix()

update_configs = {
"package_manager": "python",
"directory": '/',
"update_schedule": "weekly",
"default_reviewers": [templates.globals["assignee"]],
}
if dependabot_file.is_file():
dependabot_file.unlink()

config = {"version": 1, "update_configs": [update_configs]}

dependabot_file.write_lines([
f"# {templates.globals['managed_message']}",
"---",
_round_trip_dump(config),
])
try:
dependabot_file.parent.rmdir()
except OSError: # Not empty or doesn't exist
pass

return [dependabot_file.relative_to(repo_path).as_posix()]
return [return_filename]


@management.register("dependabotv2")
Expand Down
1 change: 0 additions & 1 deletion tests/test_core_/test_via_run_repo_helper.txt
@@ -1,6 +1,5 @@

The following files will be committed:
.dependabot/config.yml
.github/ISSUE_TEMPLATE/bug_report.md
.github/ISSUE_TEMPLATE/feature_request.md
.github/workflows/docs_test_action.yml
Expand Down
2 changes: 1 addition & 1 deletion tests/test_files/test_bots.py
Expand Up @@ -83,7 +83,7 @@ def test_dependabot(
):
managed_files = make_dependabot(tmp_pathplus, demo_environment)
assert managed_files == [".dependabot/config.yml"]
advanced_file_regression.check_file(tmp_pathplus / managed_files[0])
assert not (tmp_pathplus / managed_files[0]).is_file()


def test_make_dependabotv2(
Expand Down

0 comments on commit 4b826dc

Please sign in to comment.