Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set prerelease value when manually updated #3972

Merged
merged 2 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 21 additions & 7 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,15 +1105,29 @@ 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:
self.logger.warning("Got release %s", release.tag_name)
ludeeus marked this conversation as resolved.
Show resolved Hide resolved
ludeeus marked this conversation as resolved.
Show resolved Hide resolved
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]
ludeeus marked this conversation as resolved.
Show resolved Hide resolved

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
Loading