From 9f6036d471d25a68df87adb5ba1834d2acfc6c56 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 14 Feb 2024 05:27:25 +0100 Subject: [PATCH] small enhancement --- autoupdate_app_sources/autoupdate_app_sources.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/autoupdate_app_sources/autoupdate_app_sources.py b/autoupdate_app_sources/autoupdate_app_sources.py index e8ea9e4..0cce06d 100644 --- a/autoupdate_app_sources/autoupdate_app_sources.py +++ b/autoupdate_app_sources/autoupdate_app_sources.py @@ -179,7 +179,7 @@ class AppAutoUpdater: print(f"\n Checking {source} ...") - if "_release" in strategy: + if strategy.endswith("_release"): ( new_version, new_asset_urls, @@ -246,7 +246,7 @@ class AppAutoUpdater: return bool(todos) if "main" in todos: - if "_release" in strategy: + if strategy.endswith("_release"): title = f"Upgrade to v{new_version}" message = f"Upgrade to v{new_version}\nChangelog: {changelog_url}" else: @@ -257,6 +257,9 @@ class AppAutoUpdater: title = message = "Upgrade sources" new_branch = "ci-auto-update-sources" + print(f"Title: {title}") + print(f"Message: {message}") + try: # Get the commit base for the new branch, and create it commit_sha = self.repo.get_branch(self.base_branch).commit.sha @@ -311,7 +314,7 @@ class AppAutoUpdater: elif "gitea" in strategy or "forgejo" in strategy: api = GiteaForgejoAPI(upstream) - if "_release" in strategy: + if strategy.endswith("_release"): releases = api.releases() tags = [ release["tag_name"] @@ -388,7 +391,7 @@ class AppAutoUpdater: latest_release_html_url, ) - elif "_tag" in strategy: + elif strategy.endswith("_tag"): if asset != "tarball": raise Exception( "For the latest tag strategy, only asset = 'tarball' is supported" @@ -400,7 +403,7 @@ class AppAutoUpdater: latest_tarball = api.url_for_ref(latest_version_orig, RefType.tags) return latest_version, latest_tarball - elif "_commit" in strategy: + elif strategy.endswith("_commit"): if asset != "tarball": raise Exception( "For the latest release strategy, only asset = 'tarball' is supported"