Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Lazy "latest" GitRelease has wrong tag_name #3486

@sathieu

Description

@sathieu

Commit e79d9bc has:

if "tag_name" in attributes:
self._tag_name = self._makeStringAttribute(attributes["tag_name"])
elif "url" in attributes and attributes["url"] and isinstance(attributes["url"], str):
quoted_tag_name = attributes["url"].split("/")[-1]
tag_name = urllib.parse.unquote(quoted_tag_name)
self._tag_name = self._makeStringAttribute(tag_name)

(ref)

This is wrong when getting latest release with:

from github import Github
my_repo = Github(lazy=True).get_repo("PyGithub/PyGithub")
latest_release = my_repo.get_latest_release()
latest_release_tag = latest_release.tag_name
assert(latest_release_tag != "latest")

Workaround is to force unlazy pull:

from github import Github
my_repo = Github(lazy=True).get_repo("PyGithub/PyGithub")
latest_release = my_repo.get_latest_release()
assert(latest_release.name)
latest_release_tag = latest_release.tag_name
assert(latest_release_tag != "latest")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions