Conversation
latest resolution in build-test-publish
latest resolution in build-test-publishThere was a problem hiding this comment.
Pull request overview
This PR consolidates “latest” version resolution for GitHub releases into the shared lib/download.ab helper, so all devcontainer features consistently resolve latest without requiring GitHub API calls (and without introducing curl/jq dependencies solely for that purpose).
Changes:
- Replaces
fetch_latest_versioninlib/download.abwith redirect-based parsing ofhttps://github.com/<owner>/<repo>/releases/latest. - Updates affected features (
amber,gleam,just,lefthook) to rely on the shared helper without installingcurl/jqforlatest. - Regenerates corresponding
install.shartifacts and updates feature changelogs with an Unreleased entry describing the change.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/download.ab | Moves latest-release lookup to GitHub redirect parsing in the shared helper. |
| src/amber/install.ab | Stops adding curl/jq packages for latest, relies on shared helper. |
| src/amber/install.sh | Regenerated script reflecting shared redirect-based latest lookup. |
| src/amber/CHANGELOG.md | Documents redirect-based latest resolution in Unreleased notes. |
| src/gleam/install.ab | Stops adding curl/jq packages for latest, relies on shared helper. |
| src/gleam/install.sh | Regenerated script reflecting shared redirect-based latest lookup. |
| src/gleam/CHANGELOG.md | Documents redirect-based latest resolution in Unreleased notes. |
| src/just/install.ab | Stops adding curl/jq packages for latest, relies on shared helper. |
| src/just/install.sh | Regenerated script reflecting shared redirect-based latest lookup. |
| src/just/CHANGELOG.md | Adds Unreleased entry for redirect-based latest resolution. |
| src/lefthook/install.ab | Stops adding curl/jq packages for latest, relies on shared helper. |
| src/lefthook/install.sh | Regenerated script reflecting shared redirect-based latest lookup. |
| src/lefthook/CHANGELOG.md | Adds Unreleased entry for redirect-based latest resolution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const url = "https://api.github.com/repos/{repo_owner}/{repo_name}/releases/latest" | ||
| return $ curl -sL {url} | jq -r .tag_name $? | ||
| const url = "https://github.com/{repo_owner}/{repo_name}/releases/latest" | ||
| return $ bash -o pipefail -c "(wget -S --max-redirect=0 --spider '{url}' 2>&1 || true) | sed -n \"s#^[[:space:]]*[Ll]ocation:[[:space:]]*.*/##p\" | sed \"s#[[:space:]]*\\[following\\]##\" | tail -n1 | grep . || (echo \"Unable to determine latest release version from {url}\" >&2; exit 1)" $? |
|
@copilot Explain to me why this approach would be more robust than the old one? It looks more hacky to me - instead of reading the result from an API which is build for that, we do some magic to get the same data from a redirection. |
It isn’t more correct than the API by itself. The reason for the redirect-based lookup was narrower: avoid adding I do agree the first version was too brittle. In |
The latest-version fix had been implemented only in
lefthook, duplicating logic that already belonged in the shared download library. This change moves the redirect-based GitHub release lookup into the shared helper so every feature usingfetch_latest_versiongets the same behavior.Shared latest-version resolution
curl/jq-based implementation inlib/download.abwith redirect-based GitHub release resolution.releases/latest.Feature consumers
fetch_latest_versionimplementation and switch it back to the shared helper.amber,gleam, andjustto use the same shared behavior without addingcurl/jqonly forlatest.Generated artifacts
install.shfiles so the checked-in scripts match the Amber sources.Changelogs
Unreleasedentries for all changed features:amber,gleam,just, andlefthook.Example of the consolidation: