Skip to content

Commit

Permalink
Set prerelease value when manually updated (#3972)
Browse files Browse the repository at this point in the history
* Set prerelease value when manually updated

* Update custom_components/hacs/repositories/base.py
  • Loading branch information
ludeeus authored Aug 14, 2024
1 parent f545e86 commit 3ed2c22
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 7 deletions.
27 changes: 20 additions & 7 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,15 +1105,28 @@ async def common_update_data(
# Get releases.
if not skip_releases:
try:
releases = await self.get_releases(
prerelease=self.data.show_beta,
returnlimit=self.hacs.configuration.release_limit,
)
releases = await self.get_releases(prerelease=True, returnlimit=30)
if releases:
self.data.prerelease = None
for release in releases:
if release.draft:
continue
elif release.prerelease:
if self.data.prerelease is None:
self.data.prerelease = release.tag_name
else:
self.data.last_version = release.tag_name
break

self.data.releases = True
self.releases.objects = releases
self.data.published_tags = [x.tag_name for x in self.releases.objects]
self.data.last_version = next(iter(self.data.published_tags))

filtered_releases = [
release
for release in releases
if not release.draft and (self.data.show_beta or not release.prerelease)
]
self.releases.objects = filtered_releases
self.data.published_tags = [x.tag_name for x in filtered_releases]

except HacsException:
self.data.releases = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"last_updated": "2011-01-26T19:06:43Z",
"last_version": "1.0.0",
"manifest_name": "Proxy manifest",
"prerelease": "3.0.0",
"published_tags": [
"1.0.0"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"last_updated": "2011-01-26T19:06:43Z",
"last_version": "1.0.0",
"manifest_name": "Proxy manifest",
"prerelease": "3.0.0",
"published_tags": [
"1.0.0"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"last_updated": "2011-01-26T19:06:43Z",
"last_version": "1.0.0",
"manifest_name": "Proxy manifest",
"prerelease": "3.0.0",
"published_tags": [
"1.0.0"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"name": "Proxy manifest"
},
"manifest_name": "Proxy manifest",
"prerelease": "3.0.0",
"stargazers_count": 80,
"topics": [
"api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"name": "Proxy manifest"
},
"manifest_name": "Proxy manifest",
"prerelease": "3.0.0",
"stargazers_count": 80,
"topics": [
"api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"name": "Proxy manifest"
},
"manifest_name": "Proxy manifest",
"prerelease": "3.0.0",
"stargazers_count": 80,
"topics": [
"api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"last_version": "1.0.0",
"manifest": {},
"manifest_name": "Basic integration",
"prerelease": "3.0.0",
"stargazers_count": 80,
"topics": [
"api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"last_version": "1.0.0",
"manifest": {},
"manifest_name": "Basic integration",
"prerelease": "3.0.0",
"stargazers_count": 80,
"topics": [
"api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"last_version": "1.0.0",
"manifest": {},
"manifest_name": "Basic integration",
"prerelease": "3.0.0",
"stargazers_count": 80,
"topics": [
"api",
Expand Down

0 comments on commit 3ed2c22

Please sign in to comment.