0

About

While we all know how to get the latest release:

GET /repos/:owner/:repo/releases/latest

or https://api.github.com/repos/:owner/:repo/releases/latest
But what about the previous release?
I want to get the previous release (meaning the one before the latest release)

  • This may not be possible, in the general case, because "latest release" doesn't just mean "first when ordered but date descending"; instead, when creating a release on GitHub, you can choose whether to mark it the "latest release". To return a "previous release" under he same definition, GitHub would have to track the history of what has been marked as "latest", and they may not bother. – IMSoP Nov 27 '22 at 20:47
  • @IMSoP so the only way to do it is if Github implements it as a feature? – thefourCraft Nov 27 '22 at 20:56
  • 1
    If that's the definition you want, yes. If you just want to find the one with the closest date or tag number, you could fetch the list of releases and process it appropriately. – IMSoP Nov 27 '22 at 21:01
  • I think the best way currently is to fetch all versions, then create an array best of the dates (from the newest to oldest) and take the second oldest (one below the release) after that store it somewhere... (file or a NoSQL database) This should be possible because we have the GET for all the releases Thanks For The Info @IMSoP, IF I find a proper solution to this I will post it – thefourCraft Nov 27 '22 at 22:33

0 Answers0