Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Refactor last commit retrieval to use a non deprecated method#4898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ludeeus wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromchange-retrival-of-commit
Open
Changes fromall 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
Refactor last commit retrieval to use a non deprecated method
  • Loading branch information
@ludeeus
ludeeus committedNov 2, 2025
commitbd40f7ddf7b4b3ffcdff2911b10c9c8d9304a733
16 changes: 12 additions & 4 deletionscustom_components/hacs/repositories/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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 DownExpand 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]

[8]ページ先頭

©2009-2025 Movatter.jp