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 get_latest_repo_tag fn #1485

Merged
merged 3 commits into from
Oct 7, 2022
Merged
Changes from all commits
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
17 changes: 6 additions & 11 deletions qhub/provider/cicd/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,12 @@ def get_latest_repo_tag(owner: str, repo: str, only_clean_tags: bool = True) ->
NOTE: Set `only_clean_tags=False` to include dev / pre-release (if latest).
"""
tags = get_repo_tags(owner, repo)
tag_info = None
if only_clean_tags:
for t in tags:
# ignore dev releases
rel = list(filter(None, re.sub(r"[A-Za-z]", " ", t["name"]).split(" ")))
if len(rel) == 1:
tag_info = t
else:
tag_info = tags[0]

return tag_info.get("name")
if not only_clean_tags and len(tags) >= 1:
return tags[0].get("name")
for t in tags:
rel = list(filter(None, re.sub(r"[A-Za-z]", " ", t["name"]).split(" ")))
if len(rel) == 1:
return t.get("name")


def create_repository(owner, repo, description, homepage, private=True):
Expand Down