Validate.
(hacs: HacsBase, repository: str, category: str, ref=None)
| 158 | |
| 159 | |
| 160 | async def validate_repository(hacs: HacsBase, repository: str, category: str, ref=None): |
| 161 | """Validate.""" |
| 162 | # Legacy GitHub client |
| 163 | hacs.github = GitHub( |
| 164 | hacs.configuration.token, |
| 165 | hacs.session, |
| 166 | headers=HACS_ACTION_GITHUB_API_HEADERS, |
| 167 | ) |
| 168 | |
| 169 | try: |
| 170 | await hacs.async_register_repository( |
| 171 | repository_full_name=repository, |
| 172 | category=category, |
| 173 | ref=ref, |
| 174 | ) |
| 175 | except HacsException as exception: |
| 176 | error(exception) |
| 177 | |
| 178 | if (repo := hacs.repositories.get_by_full_name(repository)) is None: |
| 179 | error(f"Repository {repository} not loaded properly in HACS.") |
| 180 | |
| 181 | output_in_group("data", json.dumps(repo.data.to_json(), indent=4)) |
| 182 | |
| 183 | |
| 184 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…