Skip to content

Commit 97d6e8e

Browse files
Arnav Soodararslan
authored andcommitted
Make tags query /git/refs/tags instead of /git/tags (#121)
There is an API endpoint /git/tags, but that only accepts SHA1 hashes.
1 parent 7763c23 commit 97d6e8e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/git/tag.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Tag(data::Dict) = json2github(Tag, data)
1212
namefield(tag::Tag) = tag.sha
1313

1414
@api_default function tag(api::GitHubAPI, repo, tag_obj; options...)
15-
result = gh_get_json(api, "/repos/$(name(repo))/git/tags/$(name(tag_obj))"; options...)
15+
result = gh_get_json(api, "/repos/$(name(repo))/git/refs/tags/$(name(tag_obj))"; options...)
1616
return Tag(result)
1717
end
1818

test/read_only_api_tests.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,15 @@ end
197197
end
198198

199199
@testset "Tags and References" begin
200+
# All tags in this repo are lightweight tags which are not covered by the API
201+
# Maybe test in the future when we have a use case
200202
github_jl = Repo("JuliaWeb/GitHub.jl")
201203
ref = reference(github_jl, "heads/master"; auth=auth)
202204
@test ref.object["type"] == "commit"
203205

204-
# All tags in this repo are lightweight tags which are not covered by the API
205-
# Maybe test in the future when we have a use case
206+
# Tag API
207+
reponame = "QuantEcon/Expectations.jl"
208+
version = "v1.0.1"
209+
exptag = tag(reponame, version)
210+
@test isa(exptag, Tag)
206211
end

0 commit comments

Comments
 (0)