Get all .md files from a public github repo

I was unable to figure out the right setup for getting all .md files from a public repo. From that screenshot, do you have any clue of what I should fix?

Thank you!

Hey !
I don’t think that is possible directly, as the node get only the content of one file.

What you would want to do is to list the parent folder (“list” github node,) that will give you the content of the folder, each item has a type “dir” or “file”, so if you want to go deeper into folders in your project you can !

Hope this helps ! :slight_smile:

1 Like

Thanks, almost there!
But the output does not show the md files in the docs/ path, neither the sub directories like path/src/ where other md files live.
(I know I’ll have to do a loop through each file to get all .md files)

Try this:

2 Likes

The path “/” doesn’t work on my side but putting path as “” works, and after you can just specify the path in the “get a file” node !

1 Like

Man, I know I’m new, but this is really hard. I can’t figure it out or even understand the logic, it’s looping for ever on the same folder.
Let me rephrase: how do i make the git node understand that I want all MD files in here (and any sub dir):
image
docs/ or docs/src/ does not work in the git node’s path field.

You need to feed something into the github node in a variable named path to start the recursion of directories from there. The pinned data in the previous example has { “path”: “/” } to start things off.

You could also do that with a Set Edit Data node, but ultimately you need something to set it up for your first call to github. If you are familiar with how a recursive function works, this is very similar. The items passed back to the github node through the loop are only the directories, so then you would be using that path and finding .md files and other subdirectories within each of those.

2 Likes

Thank you!! :heart_eyes:

Now for an equivalent to dropdown with a few options, what would be the right route? Set Node with a Switch Node (manual selection)?

You would have a broad range of options there regarding where you load the options, how you pick which one, etc., but then you could probably use another Filter node with a condition (or multiple conditions) that would narrow to the 1 item that should feed into the rest of it.

Be careful not to send multiple items in, or your output will have all the files from all of the repos piled together.

1 Like

Hmm I see now. I guess that’s the most that can be done…
Here :point_down: I was thinking more about a real dropdown where I can select the full repo url / name option out of a dozen, instead of having to do manual input.


Wishful thinking?

Why couldn’t you use a form trigger and match the selected item to something embedded in the workflow with the rest of the info?

1 Like

Gorgeous :heart_eyes:

Sorry I should have created a new topic for better subject matter indexing. Feel free to move it if possible. Thanks!!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.