Skip to content

refactor: use getLatestRelease API instead of listReleases#48

Merged
peterdeme merged 1 commit intomainfrom
refactor-latest-release-api
Jan 25, 2026
Merged

refactor: use getLatestRelease API instead of listReleases#48
peterdeme merged 1 commit intomainfrom
refactor-latest-release-api

Conversation

@peterdeme
Copy link
Copy Markdown
Collaborator

@peterdeme peterdeme commented Jan 25, 2026

Switched to the dedicated endpoint which returns exactly what we need without fetching and filtering the entire release list.

Also renamed the CI workflow from build to test to better reflect its purpose.


Note

Refactor latest version retrieval

  • Replace octokit.rest.repos.listReleases + filtering with octokit.rest.repos.getLatestRelease in src/install.ts (and regenerated dist/index.js), simplifying logic to return tag_name directly and updating error handling.

CI workflow rename and test job

  • Rename workflow and job from build to test in .github/workflows/test.yml.
  • Run a matrix on ubuntu, macOS, and windows and add a basic spacectl smoke test (spacectl --version).

Written by Cursor Bugbot for commit fee35c8. This will update automatically on new commits. Configure here.

Switched to the dedicated endpoint which returns exactly what we need
without fetching and filtering the entire release list.

Also renamed the CI workflow from build to test to better reflect its purpose.
@peterdeme peterdeme force-pushed the refactor-latest-release-api branch from 70ff820 to fee35c8 Compare January 25, 2026 20:36
@peterdeme peterdeme marked this pull request as ready for review January 25, 2026 20:50
@peterdeme peterdeme requested a review from a team as a code owner January 25, 2026 20:50
@peterdeme peterdeme merged commit 6642b4f into main Jan 25, 2026
10 checks passed
@peterdeme peterdeme deleted the refactor-latest-release-api branch January 25, 2026 20:52
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on February 8

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

});
const releaseList = releaseResponse.data;

if (!releaseList?.length) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error handling unreachable due to API 404 exception

Medium Severity

The switch from listReleases to getLatestRelease breaks the error handling for missing releases. The old API returned an empty array when no releases exist, allowing the length check to catch it. The new API throws a 404 exception, meaning the if (!releaseResponse.data?.tag_name) check is never reached. Users now see a raw HTTP 404 error instead of the intended helpful message about GitHub outages.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant