terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

Allow for retrieving latest prerelease as data source.

Open youcandanch opened this issue 3 years ago • 2 comments

Description

Being able to retrieve the latest release from a given repository is awesome, but there's circumstances in which it'd be beneficial to grab the latest prerelease. In a continuous deployment workflow where there's a "prerelease" like environment (staging, preproduction, prerelease, rc, etc.) it'd be great to be able to pull the tag information directly from the provider, rather than having to skip out to the API to do it.

This PR introduces that functionality by allowing for passing latest_prerelease as a valid value to retrieve_by on the release data source. It's a little more involved than retrieving just the latest release, because the GitHub API at the moment doesn't allow for allowing prereleases as a flag on /latest. Instead, we're retrieving a few pages worth of releases, filtering out the prereleases, and selecting the most recently published one.

This does mean that there's a pretty substantial performance difference, as there's both more data to process and more requests being made.

youcandanch avatar Feb 13 '22 21:02 youcandanch

@kfcampbell anything I need to do on this to get it into a reviewable state? Haven't done work on the provider before so wanted to make sure I'm not missing anything. Thanks in advance!

youcandanch avatar Feb 19 '22 18:02 youcandanch

Still haven't had a moment to swing back to this, but I did open a post on the GitHub community for something similar: https://github.community/t/release-api-should-include-a-way-to-retrieve-the-latest-prerelease/239836

It'd be more ideal to handle it at the API level, I think, though that's an ask for core GitHub team and I imagine a fairly large one to think through.

youcandanch avatar Mar 23 '22 14:03 youcandanch

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

nickfloyd avatar Nov 30 '22 16:11 nickfloyd

👋 Hey Friends, this pull request has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

github-actions[bot] avatar Aug 29 '23 01:08 github-actions[bot]