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

Pull from a github folder #4739

Merged
merged 8 commits into from
Jul 15, 2024
Merged

Pull from a github folder #4739

merged 8 commits into from
Jul 15, 2024

Conversation

yann300
Copy link
Contributor

@yann300 yann300 commented Apr 18, 2024

fix #4345

Some issues still remains:

You may try by adding the url param ghfolder=https://github.com/ethereum/remix-project/tree/master/apps/remix-ide/contracts/hardhat

@yann300 yann300 self-assigned this Apr 18, 2024
Copy link

netlify bot commented Apr 18, 2024

Deploy Preview for remixproject ready!

Name Link
🔨 Latest commit 81a04b1
🔍 Latest deploy log https://app.netlify.com/sites/remixproject/deploys/6695198f384f5f00084491b1
😎 Deploy Preview https://deploy-preview-4739--remixproject.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@yann300 yann300 added the WIP label Apr 18, 2024
@yann300 yann300 force-pushed the pull_gh_folder branch 2 times, most recently from 2611396 to b76e125 Compare June 18, 2024 14:06
@yann300 yann300 added ready-to-review PR ready to review and removed WIP labels Jun 18, 2024
@yann300 yann300 requested review from ioedeveloper and ryestew June 18, 2024 14:07
@yann300 yann300 force-pushed the pull_gh_folder branch 4 times, most recently from 47b57ba to 3c490bf Compare July 2, 2024 09:58
@yann300 yann300 force-pushed the pull_gh_folder branch 3 times, most recently from a109208 to 006f8d8 Compare July 8, 2024 12:43
@@ -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)
Copy link
Member

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 })
Copy link
Member

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) {
Copy link
Member

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.

@ioedeveloper
Copy link
Member

I passed in 2 url params for 'code-sample' (ghfolder and code) at the same time to test, and a workspace was created with the content of the github folder and also the code file that was imported, all together in the same workspace. I don't know if this was the expected behaviour, but it was interesting to see.

@yann300 yann300 requested a review from ioedeveloper July 9, 2024 20:27
@ryestew
Copy link
Collaborator

ryestew commented Jul 15, 2024

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:
https://deploy-preview-4739--remixproject.netlify.app/#lang=en&ghfolder=https://github.com/pcaversaccio/snekmate/tree/main/src/snekmate/tokens
and
https://deploy-preview-4739--remixproject.netlify.app/#lang=en&ghfolder=ghfolder=https://github.com/ethereum/remix-project/tree/master/apps/remix-ide/contracts/hardhat

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.

@yann300 yann300 enabled auto-merge (rebase) July 15, 2024 12:17
@yann300 yann300 merged commit a296e69 into master Jul 15, 2024
31 of 32 checks passed
@yann300 yann300 deleted the pull_gh_folder branch July 15, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-review PR ready to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pulling in multiple files via a url
3 participants