Skip to content

Commit 61d15c0

Browse files
author
Fatih Kadir Akın
committed
pull latest tag if theres no release
1 parent 2a87b81 commit 61d15c0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

models/github_repo.cr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,19 @@ class GithubRepo
3939
headers = HTTP::Headers.new
4040
headers["User-Agent"] = "crystalshards"
4141
response = client.get("/repos/#{full_name}/releases", headers)
42-
p "pulling..."
42+
p "pulling release of #{full_name}..."
4343
releases = JSON.parse(response.body)
4444
if releases.size > 0
4545
releases[0]["tag_name"].to_s
4646
else
47-
""
47+
response = client.get("/repos/#{full_name}/tags", headers)
48+
p "release not found, pulling tag of #{full_name}..."
49+
tags = JSON.parse(response.body)
50+
if tags.size > 0
51+
tags[0]["name"].to_s
52+
else
53+
""
54+
end
4855
end
4956
end
5057
end

0 commit comments

Comments
 (0)