For some reason, however, the ‘latest release label’ doesn’t reflect the latest stable release. But, I’m neither a developer nor a GitHub expert, so I can’t offer any insight into the ‘why’ or ‘when’.
Often GitHub latest points at the latest stable release, but unfortunately it’s not always accurate due to timing of the artifact releases. i.e. if a v31 maintenance release goes up after a v32 maintenance release it’ll get tagged latest by default unless a human manually fixes it.
If you want to use the GitHub API you’d have to do something like LSIO does here in their Nextcloud image build process.
But the approach suggested by @bb77 is probably the most reliable, IMO. It’s literally pulling the data from Nextcloud’s updater infrastructure so it’s authoritative.