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

fix bug on update_package.py #1162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix bug on update_package.py #1162

wants to merge 1 commit into from

Conversation

sara-rn
Copy link
Contributor

@sara-rn sara-rn commented Nov 8, 2024

fix issue #1142 for when --update-type is GITHUB_URL

@sara-rn sara-rn linked an issue Nov 8, 2024 that may be closed by this pull request
Update comments on update_package.py

add comments that help understand the issue that the latest sclauncher doesn't get updated. The version from the regex (current version) didn't include `v` however the function get_latest_version did include the `v`. The URL replaced the version without `v` (current version) with the latest version found that included the `v`, which resulted in the wrong URL `https://github.com/jstrosch/sclauncher/releases/download/vv0.0.6/sclauncher.exe`
@@ -37,7 +37,10 @@ def get_latest_version(org, project, version):
print(f"GitHub API response not ok: {response.status_code}")
return None
latest_version = response.json()["tag_name"]
return latest_version
if latest_version.startswith('v'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naacbin introduced the support for packages whose version is preceded by v in #1067, but it seems the v was only taken into account when matching the url in the file and not to get the latest version, so it seems like the fix has never worked.

What is really getting me confused is that I see upx being correctly updated by our bot in acec181 before #1067, how is this possible? 🕵️‍♀️

@@ -37,7 +37,10 @@ def get_latest_version(org, project, version):
print(f"GitHub API response not ok: {response.status_code}")
return None
latest_version = response.json()["tag_name"]
return latest_version
if latest_version.startswith('v'):
return latest_version.replace('v','',1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit more elegant 😉

Suggested change
return latest_version.replace('v','',1)
return latest_version[1:]

@@ -104,6 +107,7 @@ def update_github_url(package):

latest_version = None
for url, org, project, version in matches:
# version excludes `v` from the capturing group in the regex therefore latest_version_match mustn't include `v` if the version starts with `v`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this comment (maybe with a bit rewording needed) just before the line if latest_version.startswith('v'):? Here it is difficult to understand what it is refering to 😕

@Ana06 Ana06 requested a review from naacbin November 12, 2024 08:26
@Ana06 Ana06 added 🐛 bug Something isn't working 🏃 CI Related to CI labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🏃 CI Related to CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bot hasn't updated sclauncher
2 participants