Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,7 @@ async def common_update(self, ignore_issues=False, force=False, skip_releases=Fa
self.data.last_updated = self.repository_object.attributes.get("pushed_at", 0)

# Update last available commit
await self.repository_object.set_last_commit()
self.data.last_commit = self.repository_object.last_commit
await self.async_set_last_commits()

# Get the content of hacs.json
if RepositoryFile.HACS_JSON in [x.filename for x in self.tree]:
Expand Down Expand Up @@ -1136,8 +1135,7 @@ async def common_update_data(
downloads = next(iter(assets)).download_count
self.data.downloads = downloads
elif self.hacs.system.generator and self.repository_object:
await self.repository_object.set_last_commit()
self.data.last_commit = self.repository_object.last_commit
await self.async_set_last_commits()

self.hacs.log.debug(
"%s Running checks against %s", self.string, self.ref.replace("tags/", "")
Expand Down Expand Up @@ -1458,3 +1456,13 @@ async def async_get_releases(self, *, first: int = 30) -> list[GitHubReleaseMode
kwargs={"per_page": 30},
)
return response.data

async def async_set_last_commits(self) -> None:
"""Set the last commit for the repository."""
response = await self.hacs.async_github_api_method(
method=self.hacs.githubapi.generic,
endpoint=f"/repos/{self.data.full_name}/branches/{self.data.default_branch}",
)
if response is not None and response.data:
last_commit = response.data["commit"]["sha"]
self.data.last_commit = last_commit[:7]