Open wuwentao opened 6 days ago
Protip: do NOT change the domain. This will cause you a lot of issues. This is not even being done inside of core because of it.
Protip: do NOT change the domain. This will cause you a lot of issues. This is not even being done inside of core because of it.
Thanks, it's really not a good choice, as the old domain owner not maintain it now, we want to work with a new domain, this domain migrate just want to save exist old user configs/entiries/devices.
if we drop it, old integration can't works in new HA, also no any bug fix, and they should start from zero with all the old configs and device history.
so we want to have a try, test it and confirm it what we can do, we have finished some config_entries/device_entries update in new domain, but still under test.
found this hacs/action failed and try to fix it.
@coderabbitai review
action/action.py (2)
`158-158`: **Update comment style for consistency.** The change from double to single hash marks for comments improves readability and consistency with common Python coding standards. --- `158-158`: **Proper exception handling in repository validation.** The use of `try-except` to handle possible exceptions during repository registration is appropriate and ensures that any issues are caught and handled gracefully.custom_components/hacs/__init__.py (2)
`90-90`: **Updated GitHub client initialization to use new headers and client names.** The changes to the GitHub client initialization include setting custom headers and client names, which are important for correct API interaction and user-agent representation. This should help with better tracking and management of API requests. Also applies to: 100-100 --- `100-100`: **Ensure startup logic is robust and handles various scenarios effectively.** The startup logic includes checks for version compatibility, data restoration success, and proper handling of conditions where HACS cannot operate alongside `custom_updater`.custom_components/hacs/repositories/integration.py (1)
`89-89`: **Refined error handling and manifest retrieval logic.** The updates include better error messages and the use of the `ref` parameter for fetching manifests, which aligns with the PR's objectives to handle different repository states more accurately. Also applies to: 94-94, 104-104custom_components/hacs/repositories/base.py (2)
`479-479`: **Correct use of the `ref` parameter in `async_get_hacs_json` call.** This change ensures that the `async_get_hacs_json` function fetches data from the correct Git reference, aligning with the PR's goals to fix branch-related issues in GitHub Actions. --- `542-542`: **Proper propagation of the `ref` parameter in repository updates.** Ensuring that the `async_get_hacs_json` function is called with the correct `ref` parameter during repository updates is crucial for accurate data fetching, particularly when dealing with multiple branches or tags.
Issue:
we want to migrate a domain name, PR: https://github.com/wuwentao/midea_ac_lan/pull/159 PR submit from fork repo with different branch name.
github action uses
hacs/action@main
to verify PR it only return “Error: Not Found” no any ERROR log or step output in debug mode.after fork it and add too many log info to print the step and args, found it caused by
ref
args miss:action.py
runhacs.async_register_repository()
withref
argsasync_register_repository
defined incustom_components/hacs/base.py
line 562, it callawait repository.async_registration(ref)
, also includeref
argsrepository.async_registration(ref)
defined incustom_components/hacs/repositories/base.py
, in line 842, it callself.validate_repository()
withoutref
args, butself.ref
is availablevalidate_repository()
defined incustom_components/hacs/repositories/integration.py
, in line 73, it callcommon_validate
incustom_components/hacs/repositories/base.py
, and it will run this lineif manifest := await self.async_get_hacs_json():
, it missedref
args, so add arg:ref=self.ref
to fix it.custom_components/hacs/repositories/integration.py
after line 73 invalidate_repository()
.if manifest := await self.async_get_integration_manifest():
, also missed ref args and use default branch value.async_get_integration_manifest
, as there is domain rename and dir rename, default branch don't have this dir andmainfest.json
, it continue using default branch and callresponse = await self.hacs.async_github_api_method()
in line 183async_github_api_method()
definded incustom_components/hacs/base.py
line 492, andtry
job can't pass with a exception:Not Found
, so only print this error log.checked with the same
async_get_integration_manifest
andasync_get_hacs_json
, addref=self.ref
to run it in normal branch and action.issue fixed.
in addtion, also remove some minior error , like duplicate
##
comments, removefrom .utils.json import json_loads
as import but not used.please help to review and confirm whether it's the expect result.
github action error log: https://github.com/wuwentao/midea_ac_lan/actions/runs/9672246348/job/26686312538
after add the
ref
args fix, it can report the expect ERROR log as below: https://github.com/wuwentao/midea_ac_lan/actions/runs/9672246348/job/26687155544Thanks