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

Can't Load Gist #38

Open
dsanders11 opened this issue Oct 1, 2022 · 5 comments · May be fixed by #50
Open

Can't Load Gist #38

dsanders11 opened this issue Oct 1, 2022 · 5 comments · May be fixed by #50
Assignees
Labels
area:gist 🪲 bug Something isn't working

Comments

@dsanders11
Copy link
Member

GitHub switched the default branch for gists to main a while ago, but fiddle-core's built in gist loading will try to check out master.

Simple solution would be to use main when cloning the gist, but old gists will still be using master. Most robust solution is probably to port the code in Fiddle's src/renderer/remote-loader.ts and use Octokit to grab the gist instead of just git.

@dsanders11 dsanders11 added the 🪲 bug Something isn't working label Oct 1, 2022
@aryanshridhar aryanshridhar self-assigned this Oct 2, 2022
@aryanshridhar
Copy link
Collaborator

aryanshridhar commented Oct 5, 2022

How about first trying out master and if it fails then checking out with main to fetch the gist? Maybe some try/catch blocks will handle this for us.
Or is it still that using Octokit is much bugproof solution avoiding weird cornercases?

@dsanders11
Copy link
Member Author

Or is it still that using Octokit is much bugproof solution avoiding weird cornercases?

I think there are two main advantages to using Octokit like in Fiddle:

  • No dependency on Git being installed on the system (simple-git requires that currently)
  • Octokit can use a GitHub token to avoid rate-limiting problems

I think the rate-limiting is less of a concern when doing simple Git commands (as opposed to using the API), but I can find some examples on Google of folks getting rate-limited on git commands with GitHub.

I think removing the need for Git on the system is a strong reason to use Octokit, since it makes it easier to use fiddle-core on any machine.

@aryanshridhar
Copy link
Collaborator

aryanshridhar commented Oct 6, 2022

Sounds good! I believe we can fetch GitHub gists without being authenticated (token) using Octokit but for better rate limits we might need a token in that case.
Should we create a new API (and new CLI arg) in fiddle-core that takes in the token if provided by the user?
(This token can be used in fiddle as well)

@dsanders11
Copy link
Member Author

Should we create a new API (and new CLI arg) in fiddle-core that takes in the token if provided by the user?
(This token can be used in fiddle as well)

It's generally a good idea to avoid providing access tokens as arguments, otherwise they stay exposed in command history, and any usage on for example CI jobs would show the token. For use with the CLI it would be better to use an environment variable, something like FIDDLE_CORE_GITHUB_TOKEN.

@aryanshridhar
Copy link
Collaborator

Yup, makes sense. Working on it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:gist 🪲 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants