From 60a80d3fd25237bcb0883cddca09c6098e510e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 13 Aug 2024 11:49:35 +0200 Subject: [PATCH] Only set prerelease once (#3965) --- scripts/data/generate_category_data.py | 3 +- .../integration-basic/releases.json | 84 +++++++++++++++++-- 2 files changed, 81 insertions(+), 6 deletions(-) diff --git a/scripts/data/generate_category_data.py b/scripts/data/generate_category_data.py index 1e2936b9cb8..4a1a0add727 100644 --- a/scripts/data/generate_category_data.py +++ b/scripts/data/generate_category_data.py @@ -231,7 +231,8 @@ async def concurrent_update_repository(self, repository: HacsRepository) -> None elif release.prerelease: repository.logger.info( "%s Found prerelease %s", repository.string, release.tag_name) - repository.data.prerelease = release.tag_name + if repository.data.prerelease is None: + repository.data.prerelease = release.tag_name else: repository.logger.info( diff --git a/tests/fixtures/proxy/api.github.com/repos/hacs-test-org/integration-basic/releases.json b/tests/fixtures/proxy/api.github.com/repos/hacs-test-org/integration-basic/releases.json index c0396e2902d..763840f63bd 100644 --- a/tests/fixtures/proxy/api.github.com/repos/hacs-test-org/integration-basic/releases.json +++ b/tests/fixtures/proxy/api.github.com/repos/hacs-test-org/integration-basic/releases.json @@ -1,12 +1,12 @@ [ { - "url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/3", + "url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/4", "html_url": "https://github.com/hacs-test-org/integration-basic/releases/3.0.0", - "assets_url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/3/assets", - "upload_url": "https://uploads.github.com/repos/hacs-test-org/integration-basic/releases/3/assets{?name,label}", + "assets_url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/4/assets", + "upload_url": "https://uploads.github.com/repos/hacs-test-org/integration-basic/releases/4/assets{?name,label}", "tarball_url": "https://api.github.com/repos/hacs-test-org/integration-basic/tarball/3.0.0", "zipball_url": "https://api.github.com/repos/hacs-test-org/integration-basic/zipball/3.0.0", - "id": 3, + "id": 4, "node_id": "MDc6UmVsZWFzZTE=", "tag_name": "3.0.0", "target_commitish": "master", @@ -38,7 +38,7 @@ }, "assets": [ { - "url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/assets/3", + "url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/assets/4", "browser_download_url": "https://github.com/hacs-test-org/integration-basic/releases/download/3.0.0/example.zip", "id": 1, "node_id": "MDEyOlJlbGVhc2VBc3NldDE=", @@ -73,6 +73,80 @@ } ] }, + { + "url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/3", + "html_url": "https://github.com/hacs-test-org/integration-basic/releases/2.5.0", + "assets_url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/3/assets", + "upload_url": "https://uploads.github.com/repos/hacs-test-org/integration-basic/releases/3/assets{?name,label}", + "tarball_url": "https://api.github.com/repos/hacs-test-org/integration-basic/tarball/2.5.0", + "zipball_url": "https://api.github.com/repos/hacs-test-org/integration-basic/zipball/2.5.0", + "id": 3, + "node_id": "MDc6UmVsZWFzZTE=", + "tag_name": "2.5.0", + "target_commitish": "master", + "name": "2.5.0", + "body": "Description of the release", + "draft": false, + "prerelease": true, + "created_at": "2013-02-27T19:35:32Z", + "published_at": "2013-02-27T19:35:32Z", + "author": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/hacs-test-org/followers", + "following_url": "https://api.github.com/users/hacs-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hacs-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hacs-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hacs-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hacs-test-org/orgs", + "repos_url": "https://api.github.com/users/hacs-test-org/repos", + "events_url": "https://api.github.com/users/hacs-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hacs-test-org/received_events", + "type": "User", + "site_admin": false + }, + "assets": [ + { + "url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/assets/3", + "browser_download_url": "https://github.com/hacs-test-org/integration-basic/releases/download/2.5.0/example.zip", + "id": 1, + "node_id": "MDEyOlJlbGVhc2VBc3NldDE=", + "name": "example.zip", + "label": "short description", + "state": "uploaded", + "content_type": "application/zip", + "size": 321024, + "download_count": 32425, + "created_at": "2013-02-27T19:35:32Z", + "updated_at": "2013-02-27T19:35:32Z", + "uploader": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/hacs-test-org/followers", + "following_url": "https://api.github.com/users/hacs-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hacs-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hacs-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hacs-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hacs-test-org/orgs", + "repos_url": "https://api.github.com/users/hacs-test-org/repos", + "events_url": "https://api.github.com/users/hacs-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hacs-test-org/received_events", + "type": "User", + "site_admin": false + } + } + ] + }, { "url": "https://api.github.com/repos/hacs-test-org/integration-basic/releases/2", "html_url": "https://github.com/hacs-test-org/integration-basic/releases/2.0.0",