Update HACS
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
"""Base class for validation."""
|
||||
from __future__ import annotations
|
||||
|
||||
from time import monotonic
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ..enums import HacsCategory
|
||||
from ..exceptions import HacsException
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -17,7 +17,9 @@ class ValidationException(HacsException):
|
||||
class ActionValidationBase:
|
||||
"""Base class for action validation."""
|
||||
|
||||
category: str = "common"
|
||||
categories: list[HacsCategory] = []
|
||||
allow_fork: bool = True
|
||||
more_info: str = "https://hacs.xyz/docs/publish/action"
|
||||
|
||||
def __init__(self, repository: HacsRepository) -> None:
|
||||
self.hacs = repository.hacs
|
||||
@@ -34,18 +36,18 @@ class ActionValidationBase:
|
||||
|
||||
async def execute_validation(self, *_, **__) -> None:
|
||||
"""Execute the task defined in subclass."""
|
||||
self.hacs.log.info("<Validation %s> Starting validation", self.slug)
|
||||
|
||||
start_time = monotonic()
|
||||
self.failed = False
|
||||
|
||||
try:
|
||||
await self.async_validate()
|
||||
except ValidationException as exception:
|
||||
self.failed = True
|
||||
self.hacs.log.error("<Validation %s> failed: %s", self.slug, exception)
|
||||
self.hacs.log.error(
|
||||
"<Validation %s> failed: %s (More info: %s )",
|
||||
self.slug,
|
||||
exception,
|
||||
self.more_info,
|
||||
)
|
||||
|
||||
else:
|
||||
self.hacs.log.debug(
|
||||
"<Validation %s> took %.3f seconds to complete", self.slug, monotonic() - start_time
|
||||
)
|
||||
self.hacs.log.info("<Validation %s> completed", self.slug)
|
||||
|
||||
Reference in New Issue
Block a user