You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like a bug was introduced post 1.10.8 with the introduction of support for updating existing configs, when update_existing is false and the existing configuration file extension does not match the first one defined in filename_list:
Because check_existing_config eats the exception and returns None when the file doesn't exist and also returns None when the file exists AND update_existing=false, dependabot_filename_to_use is always filename_list[0], so if there is a pre-existing file with the name filename_list[1], then a PR will be created despite a dependabot config already being present.
This also results in the confusing job output:
Skipping org/repo (dependabot file already exists)
Checking org/repo for compatible package managers
Created pull request https://github.com/org/repo/pull/41
To Reproduce
See above
Expected behavior
Dependabot not to create a PR when update_existing=false, a dependabot config already exists, and the existing file has any supported file extension, not just the default one.
Screenshots
No response
Additional context
I'd suggest that either:
check_existing_config provide the caller a way to differentiate between the file not existing and it existing, but should not be updated
refactor the calling code to handle testing for existing config vs whether to update the existing config, similar to below:
defcheck_existing_config(repo, filename, update_existing):
""" Check if the dependabot file already exists in the repository and return the existing config if it does Args: repo (github3.repos.repo.Repository): The repository to check filename (str): The dependabot configuration filename to check Returns: github3.repos.contents.Contents | None: The existing config if it exists, otherwise None """existing_config=Nonetry:
existing_config=repo.file_contents(filename)
ifexisting_config.size>0:
returnexisting_configelse:
returnNoneexceptgithub3.exceptions.NotFoundError:
passreturnexisting_config
Do note, that I have not even verified the above code will parse, let alone function correctly.
The text was updated successfully, but these errors were encountered:
Describe the bug
It looks like a bug was introduced post 1.10.8 with the introduction of support for updating existing configs, when update_existing is false and the existing configuration file extension does not match the first one defined in filename_list:
evergreen/evergreen.py
Lines 82 to 89 in ff2f3ff
evergreen/evergreen.py
Lines 210 to 234 in ff2f3ff
Because check_existing_config eats the exception and returns None when the file doesn't exist and also returns None when the file exists AND update_existing=false, dependabot_filename_to_use is always filename_list[0], so if there is a pre-existing file with the name filename_list[1], then a PR will be created despite a dependabot config already being present.
This also results in the confusing job output:
To Reproduce
See above
Expected behavior
Dependabot not to create a PR when update_existing=false, a dependabot config already exists, and the existing file has any supported file extension, not just the default one.
Screenshots
No response
Additional context
I'd suggest that either:
Do note, that I have not even verified the above code will parse, let alone function correctly.
The text was updated successfully, but these errors were encountered: