[FIX] Find draft GitHub releases using tag #26
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Draft releases are not found at the
releases/tags/<tag>
endpoint, but are still associated with the tag name.If we can't find a release at
releases/tags/<tag>
, then we iterate through all releases looking for one with a matching tag name.It may be better to come up with a GraphQL query instead of iterating through all releases via the REST API?
The GH CLI implements release fetching as: https://github.com/cli/cli/blob/30066b0042d0c5928d959e288144300cb28196c9/pkg/cmd/release/shared/fetch.go#L134-L161
The draft release lookup uses a GraphQL query: https://github.com/cli/cli/blob/30066b0042d0c5928d959e288144300cb28196c9/pkg/cmd/release/shared/fetch.go#L169-L200
Currently I'm unsure of what the best way to make a GraphQL request is in kohsuke github, although I wonder if this is fine as a stopgap here and fetching draft releases should later be implemented upstream using GraphQL?
I've opened hub4j/github-api#1983 upstream.