quarto-dev / quarto-actions

GNU General Public License v2.0
228 stars 53 forks source link

Replace version detection with direct GH API access #78

Closed cscheid closed 1 year ago

cscheid commented 1 year ago

We shouldn't be using _download.json or _prerelease.json, and instead we should be querying the github API.

We need to make this change because whenever we accidentally ship a quarto version that breaks the website rendering, _download.json is not updated, which means that there's no way for quarto-actions to ever see a new version of quarto to use. This circularity causes a lot of manual work every time we need to fix the website.

By running against the github API directly, we'll have the correct releases available to the github actions without needing a functioning website. Since we use quarto-actions to build quarto-web, this should allow us to get unstuck without manual intervention.

dragonstyle commented 1 year ago

lgtm!

cscheid commented 1 year ago

So this is possible without a whole new action to maintain. Just saying in case we think it is simpler (to use gh CLI or query Github API with curl)

Let's just do that instead! Your solution is much cleaner. Let's throw away this PR and do it right.

cderv commented 1 year ago

Oh good; Here are the two calls to use

> gh api repos/quarto-dev/quarto-cli/releases | jq -r 'map(select(.prerelease | not)) | first | .tag_name'
v1.3.353
> gh api repos/quarto-dev/quarto-cli/releases | jq -r 'map(select(.prerelease)) | first | .tag_name'
v1.4.92

They can also be obtain using curl and API REST point if we don't want gh CLI.

Probably using for latest release and prerelease keywork should not break https://github.com/quarto-dev/quarto-actions/issues/5 as the fix I did was not using gh when a version is pinned.