Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Next release
============

Features (CLI and Python API)
-----------------------------

* ``ref`` command:

* ``list``: Consolidate tags listing using [refs and refs/tags](https://developer.github.com/v3/git/refs/#get-all-references)
endpoints. In practice, we observed that tags can be listed with one or the other.


1.5.3
=====

Expand Down
15 changes: 15 additions & 0 deletions github_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,10 +877,25 @@ def get_refs(repo_name, tags=None, pattern=None):
# If "tags" is True, keep only "refs/tags/*"
data = response.json()
if tags:
tag_names = []
data = []
for ref in response.json():
if ref['ref'].startswith("refs/tags"):
data.append(ref)
tag_names.append(ref["ref"])

try:
response = _request(
'GET',
GITHUB_API + '/repos/{0}/git/refs/tags'.format(repo_name))
response.raise_for_status()
for ref in response.json():
if ref["ref"] not in tag_names:
data.append(ref)
except requests.exceptions.HTTPError as exc_info:
response = exc_info.response
if response.status_code != 404:
raise

# If "pattern" is not None, select only matching references
filtered_data = data
Expand Down