From 0c163d56bc819d1c632d9eaae22a98b69de6cf13 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 8 Jul 2025 23:34:28 +0000 Subject: [PATCH 1/3] Initial plan From f4a8eecd86bfd3cf64340e18a4200a3b6eb3507d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 8 Jul 2025 23:41:48 +0000 Subject: [PATCH 2/3] Fix registries deletion bug and add regression test Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com> --- dependabot_file.py | 3 --- test_dependabot_file.py | 50 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/dependabot_file.py b/dependabot_file.py index dfe67ab..1dbc09f 100644 --- a/dependabot_file.py +++ b/dependabot_file.py @@ -11,7 +11,6 @@ # Define data structure for dependabot.yaml data = { "version": 2, - "registries": {}, "updates": [], } @@ -60,8 +59,6 @@ def make_dependabot_config( dependabot_config["updates"][-1].update( {"registries": [SingleQuotedScalarString(ecosystem)]} ) - else: - dependabot_config.pop("registries", None) if schedule_day: dependabot_config["updates"][-1].update( diff --git a/test_dependabot_file.py b/test_dependabot_file.py index bed3264..92d8a37 100644 --- a/test_dependabot_file.py +++ b/test_dependabot_file.py @@ -819,6 +819,56 @@ def test_build_dependabot_file_with_labels(self): ) self.assertEqual(result, expected_result) + def test_build_dependabot_file_preserves_existing_registries(self): + """Test that existing registries are preserved when adding new ecosystems""" + repo = MagicMock() + repo.file_contents.side_effect = lambda filename: filename == "Gemfile" + + # Create existing config with registries but no bundler ecosystem + existing_config = MagicMock() + existing_config.content = base64.b64encode( + b""" +version: 2 +registries: + gradle-artifactory: + type: maven-repository + url: https://acme.jfrog.io/artifactory/my-gradle-registry + username: octocat + password: ${{secrets.MY_ARTIFACTORY_PASSWORD}} +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" +""" + ) + + expected_result = yaml.load( + b""" +version: 2 +registries: + gradle-artifactory: + type: maven-repository + url: https://acme.jfrog.io/artifactory/my-gradle-registry + username: octocat + password: ${{secrets.MY_ARTIFACTORY_PASSWORD}} +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: 'bundler' + directory: '/' + schedule: + interval: 'weekly' +""" + ) + + result = build_dependabot_file( + repo, False, [], {}, existing_config, "weekly", "", [], None + ) + self.assertEqual(result, expected_result) + if __name__ == "__main__": unittest.main() From 36c946d1ea91e79b6a6fe78a1d3596c5116bde12 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 8 Jul 2025 23:55:52 +0000 Subject: [PATCH 3/3] fix: Remove trailing whitespace from test file to fix linting issues Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com> --- test_dependabot_file.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test_dependabot_file.py b/test_dependabot_file.py index 92d8a37..61c8901 100644 --- a/test_dependabot_file.py +++ b/test_dependabot_file.py @@ -823,7 +823,7 @@ def test_build_dependabot_file_preserves_existing_registries(self): """Test that existing registries are preserved when adding new ecosystems""" repo = MagicMock() repo.file_contents.side_effect = lambda filename: filename == "Gemfile" - + # Create existing config with registries but no bundler ecosystem existing_config = MagicMock() existing_config.content = base64.b64encode( @@ -842,7 +842,7 @@ def test_build_dependabot_file_preserves_existing_registries(self): interval: "weekly" """ ) - + expected_result = yaml.load( b""" version: 2 @@ -863,7 +863,7 @@ def test_build_dependabot_file_preserves_existing_registries(self): interval: 'weekly' """ ) - + result = build_dependabot_file( repo, False, [], {}, existing_config, "weekly", "", [], None )
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: