Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.5k
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 intomainChoose a base branch fromchange-retrival-of-commit
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Refactor last commit retrieval to use a non deprecated method
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commitbd40f7ddf7b4b3ffcdff2911b10c9c8d9304a733
There are no files selected for viewing
16 changes: 12 additions & 4 deletionscustom_components/hacs/repositories/base.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.async_set_last_commits() | ||
| # Get the content of hacs.json | ||
| if RepositoryFile.HACS_JSON in [x.filename for x in self.tree]: | ||
| @@ -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.async_set_last_commits() | ||
| self.hacs.log.debug( | ||
| "%s Running checks against %s", self.string, self.ref.replace("tags/", "") | ||
| @@ -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}", | ||
ludeeus marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| ) | ||
| if response is not None and response.data: | ||
| last_commit = response.data["commit"]["sha"] | ||
| self.data.last_commit = last_commit[:7] | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.