You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug getReleaseByTagName is only able to find published releases, not draft releases.
This is caused by draft releases not being accessible via the GET /repos/:owner/:repo/releases/tags/:tag endpoint.
Draft releases do have the tag_name attribute set correctly, however they are only accessible via:
GET /repos/:owner/:repo/releases
GET /repos/:owner/:repo/releases/:id
GraphQL
Without this, the only way I am able to find draft releases is by iterating over listReleases().
To Reproduce
Steps to reproduce the behavior:
Create a draft release on a GitHub repo
Attempt to use getReleaseByTagName to retrieve the release information
See that null is returned instead
Expected behavior
I expect either getReleaseByTagName to lookup draft releases, or an alternative method be added to do so.
If a new method is added, I'm not sure the best name for it.
Desktop (please complete the following information):
OS: NixOS 24.11
Browser Firefox 131
Version github-api 1.318
Additional context getReleaseByTagName was added in #411
The gh CLI implements its FetchReleases function as first using the GET /repos/:owner/:repo/releases/tags/:tag endpoint, and then falling back to a fetchDraftRelease function which finds the release via a GraphQL qurey and then gets all the data via a GET /repos/:owner/:repo/releases/:id request.
In the gh CLI implementation, fetching a draft release requires three requests:
Lookup GET /repos/:owner/:repo/releases/tags/:tag (404)
Lookup GraphQL query
Lookup GET /repos/:owner/:repo/releases/:id
The first request is not strictly necessary, since the GraphQL query will also find non-draft releases.
I was able to use the following query to get the tag's id for draft tags:
Describe the bug
getReleaseByTagName
is only able to find published releases, not draft releases.This is caused by draft releases not being accessible via the
GET /repos/:owner/:repo/releases/tags/:tag
endpoint.Draft releases do have the
tag_name
attribute set correctly, however they are only accessible via:GET /repos/:owner/:repo/releases
GET /repos/:owner/:repo/releases/:id
Without this, the only way I am able to find draft releases is by iterating over
listReleases()
.To Reproduce
Steps to reproduce the behavior:
getReleaseByTagName
to retrieve the release informationnull
is returned insteadExpected behavior
I expect either
getReleaseByTagName
to lookup draft releases, or an alternative method be added to do so.If a new method is added, I'm not sure the best name for it.
Desktop (please complete the following information):
Additional context
getReleaseByTagName
was added in #411The
gh
CLI implements itsFetchReleases
function as first using theGET /repos/:owner/:repo/releases/tags/:tag
endpoint, and then falling back to afetchDraftRelease
function which finds the release via a GraphQL qurey and then gets all the data via aGET /repos/:owner/:repo/releases/:id
request.In the
gh
CLI implementation, fetching a draft release requires three requests:GET /repos/:owner/:repo/releases/tags/:tag
(404)GET /repos/:owner/:repo/releases/:id
The first request is not strictly necessary, since the GraphQL query will also find non-draft releases.
I was able to use the following query to get the tag's id for draft tags:
The text was updated successfully, but these errors were encountered: