-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Pull from a github folder #4739
Conversation
✅ Deploy Preview for remixproject ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
2611396
to
b76e125
Compare
47b57ba
to
3c490bf
Compare
a109208
to
006f8d8
Compare
@@ -307,6 +306,14 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe | |||
await workspaceProvider.set(path, content) | |||
} | |||
} | |||
if (params.ghfolder) { | |||
const files = await plugin.call('contentImport', 'resolveGithubFolder', params.ghfolder) | |||
console.log(files) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console.log
rootPath = rootPath || folderPath | ||
for (const item of child) { | ||
if (item.type === 'file') { | ||
const response: AxiosResponse = await axios.get(item.download_url, { transformResponse: res => res }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like transformResponse
is not being used here.
const pathParts = pathname.split('/'); | ||
const folderPath = pathParts.slice(5).join('/'); | ||
rootPath = rootPath || folderPath | ||
for (const item of child) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a check to ensure that child
can be iterated over, because it throws an error when i pass in a path that points to a github file.
I passed in 2 url params for |
I just tried it on Chrome and the code-sample folder was created but nothing was in it. I tried it with both this url: Then I tried it on Firefox and it worked. Then I tried it again on chrome and it worked. My connection is a bit slow here. A few weeks back this PR was not working at all for me. Now it is improved. |
fix #4345
Some issues still remains:
it still need a gh token otherwise it quickly reach the api rate limit.it actually add the current folder in remix. eg for https://github.com/yann300/ethereumjs-vm/tree/master/examples , it creates theexamples
folder.it puts everything under the=> not an issue as it seemscode-sample
workspace.You may try by adding the url param
ghfolder=https://github.com/ethereum/remix-project/tree/master/apps/remix-ide/contracts/hardhat