Suppose a repo myname/myrepo
with github pages enabled, then myname.github.io/myrepo
will be available, hosting same content as original repo without any dedicated deployment.
repo
|-- folder
|-- file1
|-- file2
I expect to send http request like myname.github.io/myrepo/folder
to get something like ['file1', 'file2']
dynamically (even just a string I can parse through javascript), like nginx autoindex.
How can I achieve this?
Note: I know I can write a script, possibly in any language like bash, python, ruby, perl, to name endlessly, to generate the index file. I do not want any additional deployment, even with CI.
Inspired by octotree
(a chrome plugin for github), send API GET https://api.github.com/repos/{owner}/{repo}/git/trees/master
to get root folder structure and recursively visit children of "type": "tree"
.
As github API has rate limit of 5000 requests / hour, this might not be good for deep and wide tree.
If using the script for generating an index file is not what you wanted, there's no other way to get that.
GitHub Pages used to allow .PHP files where you could do something similar in an easier way (see here), but this feature is not available, so the script mentioned above generates static files for it.
There's no other way i know to achieve this. Why don't you want to use the script? (special reasons?) Please give more information of what you could use so we can find other ways.
UPDATE 1:
I found something that could make it work, but needs to be installed, so you might not like it (see "*note" below). This is a bit outdated (last commit on Feb).
*Note: most people would agree that to achieve what you want, you'll need a server-side language, but php is not supported on GHP as explained before. See more here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With