@@ -293,6 +293,40 @@ def test_build_dependabot_file_with_terraform_without_files(self):
293
293
result = build_dependabot_file (repo , False , [], None )
294
294
self .assertIsNone (result )
295
295
296
+ def test_build_dependabot_file_with_github_actions (self ):
297
+ """Test that the dependabot.yml file is built correctly with GitHub Actions"""
298
+ repo = MagicMock ()
299
+ response = MagicMock ()
300
+ response .status_code = 404
301
+ repo .file_contents .side_effect = github3 .exceptions .NotFoundError (resp = response )
302
+ repo .directory_contents .side_effect = lambda path : (
303
+ [("test.yml" , None )] if path == ".github/workflows" else []
304
+ )
305
+
306
+ expected_result = """---
307
+ version: 2
308
+ updates:
309
+ - package-ecosystem: 'github-actions'
310
+ directory: '/'
311
+ schedule:
312
+ interval: 'weekly'
313
+ """
314
+ result = build_dependabot_file (repo , False , [], None )
315
+ self .assertEqual (result , expected_result )
316
+
317
+ def test_build_dependabot_file_with_github_actions_without_files (self ):
318
+ """Test that the dependabot.yml file is None when no YAML files are found in the .github/workflows/ directory."""
319
+ repo = MagicMock ()
320
+ response = MagicMock ()
321
+ response .status_code = 404
322
+ repo .file_contents .side_effect = github3 .exceptions .NotFoundError (resp = response )
323
+ repo .directory_contents .side_effect = github3 .exceptions .NotFoundError (
324
+ resp = response
325
+ )
326
+
327
+ result = build_dependabot_file (repo , False , [], None )
328
+ self .assertEqual (result , None )
329
+
296
330
def test_build_dependabot_file_with_groups (self ):
297
331
"""Test that the dependabot.yml file is built correctly with grouped dependencies"""
298
332
repo = MagicMock ()
0 commit comments