Remove deprecated repository_object.get_contents usage from appdaemon#4900
Open
Remove deprecated repository_object.get_contents usage from appdaemon#4900
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the AppDaemon repository handling to use the git tree API directly instead of making separate API calls to list directory contents. This optimization reduces the number of GitHub API calls required during repository validation and updates.
Key changes:
- Replaced separate GitHub API calls with tree-based directory lookup using
get_first_directory_in_directory - Updated test snapshots to reflect the reduced API call count (removed calls to
/contents/appsand/contents/apps/example) - Fixed test fixture data to correct directory structure (changed
appdaemonstoapps)
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| custom_components/hacs/repositories/appdaemon.py | Refactored validate_repository and update_repository methods to use tree-based lookup instead of GitHub API calls |
| tests/snapshots/api-usage/tests/scripts/data/test_generate_category_datatest-generate-category-data-single-repository-hacs-test-org-appdaemon-basic.json | Updated snapshot to reflect removed API calls |
| tests/snapshots/api-usage/tests/scripts/data/test_generate_category_datatest-generate-category-data-hacs-test-org-appdaemon-basic.json | Updated snapshot to reflect removed API calls |
| tests/snapshots/api-usage/tests/repositories/test_update_repositorytest-update-repository-websocket-hacs-test-org-appdaemon-basic.json | Updated snapshot to reflect removed API calls |
| tests/snapshots/api-usage/tests/repositories/test_update_repositorytest-update-repository-entity-hacs-test-org-appdaemon-basic.json | Updated snapshot to reflect removed API calls |
| tests/snapshots/api-usage/tests/repositories/test_remove_repositorytest-remove-repository-hacs-test-org-appdaemon-basic.json | Updated snapshot to reflect removed API calls |
| tests/snapshots/api-usage/tests/repositories/test_download_repositorytest-download-repository-hacs-test-org-appdaemon-basic.json | Updated snapshot to reflect removed API calls |
| tests/fixtures/proxy/api.github.com/repos/hacs-test-org/appdaemon-basic/git/trees/main.json | Fixed typo in directory path and added proper tree structure entries |
| tests/fixtures/proxy/api.github.com/repos/hacs-test-org/appdaemon-basic/git/trees/2.0.0.json | Fixed typo in directory path and added proper tree structure entries |
| tests/fixtures/proxy/api.github.com/repos/hacs-test-org/appdaemon-basic/git/trees/1.0.0.json | Fixed typo in directory path and added proper tree structure entries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/fixtures/proxy/api.github.com/repos/hacs-test-org/appdaemon-basic/git/trees/main.json
Outdated
Show resolved
Hide resolved
tests/fixtures/proxy/api.github.com/repos/hacs-test-org/appdaemon-basic/git/trees/2.0.0.json
Outdated
Show resolved
Hide resolved
tests/fixtures/proxy/api.github.com/repos/hacs-test-org/appdaemon-basic/git/trees/1.0.0.json
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.