Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple strategies for querying GitHub release and assets info #11

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

wagoodman
Copy link
Contributor

@wagoodman wagoodman commented Oct 17, 2023

The github v4 api is a little heavy for the github installer strategy in binny. Specifically a github token is required for use at all, and though the v3 api does not require this, it fetches a lot more information (is slower) and has pretty strict rate limiting. For this reason I've decided to add multiple strategies for fetching release information.

For installing, 3 strategies are attempted in the following order:

  • scrape the https://github.com/<user>/<repo>/releases/expanded_assets/<tag-or-latest> endpoint that drives the github UI. This is brittle, however, is the quickest way to get a list of all assets for a release universally. The risk is that GitHub may decide to change this endpoint at any time in the future for no reason or warning.
  • guess a variety of checksums.txt assets that may or may not be there, then use the contents for a listing of assets. This is not universally guaranteed and there are a few common patterns to try so it is not an ideal solution to use as a default.
  • use the v4 api as done today, which requires a token. (note: a better error message is now provided when there is no token available).

For updating the version locks, 2 strategies are attempted in the following order:

  • fetch the latest release tag from https://github.com/<user>/<repo>/releases/latest (accepting application/json)
  • use the v4 api as done today to get all releases, which requires a token.

For an update strategy to be deemed working, the result must not be empty and must also satisfy any user-given version constraint, otherwise the next strategy is attempted.

These updates will make binny not only faster but also not require a github token by default 🎉

@wagoodman wagoodman added the enhancement New feature or request label Oct 17, 2023
@wagoodman wagoodman marked this pull request as draft October 17, 2023 13:03
@wagoodman wagoodman changed the title Add multiple strategies for querying release and assets info Add multiple strategies for querying GitHub release and assets info Oct 17, 2023
@wagoodman wagoodman marked this pull request as ready for review October 17, 2023 15:27
@wagoodman wagoodman merged commit fe88335 into main Oct 17, 2023
2 checks passed
@wagoodman wagoodman deleted the use-gh-v4-api-last branch October 17, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant