Uberspace / lab

The Uberlab provides various tutorials - written by you! - on how to run software and tools on Uberspace 7.
https://lab.uberspace.de
Other
315 stars 414 forks source link

[mattermost] the update scripts API call does not follow the redirect #1543

Closed EV21 closed 1 year ago

EV21 commented 1 year ago

GitHub redirects to another location. I have not seen this behavior before on that endpoint and for other repositories that call works just like before. So in this case we need to change the API call so it follows that redirect

This may effect other update scripts as GitHub expects Clients to always follow redirects: https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#http-redirects

Issue

{
  "message": "Moved Permanently",
  "url": "https://api.github.com/repositories/37448451/releases/latest",
  "documentation_url": "https://docs.github.com/v3/#http-redirects"
}

Fix

-   tag_name=$(curl -s https://api.github.com/repos/mattermost/mattermost-server/releases/latest | jq --raw-output '.tag_name')
+   tag_name=$(curl --silent --location https://api.github.com/repos/mattermost/mattermost-server/releases/latest |
+        jq --raw-output '.tag_name')

Originally posted by @EV21 in https://github.com/Uberspace/lab/issues/1482#issuecomment-1576348467

Thanks to @errotu for this finding