You won’t be able to use listdir for this. You might be able to do something by making a request to the GitHub API. Check out this related StackOverflow post
I actually found a way. Might not be the best one but it works.
I used python requests and BeautifuSup libraries
here i listed only the *.csv files
import requests
from bs4 import BeautifulSoup
# URL on the Github where the csv files are stored
github_url = 'https://github.com/USERNAME/REPOSITORY/tree/master/FOLDER' # change USERNAME, REPOSITORY and FOLDER with actual name
result = requests.get(github_url)
soup = BeautifulSoup(database.text, 'html.parser')
csvfiles = soup.find_all(title=re.compile("\.csv$"))
filename = [ ]
for i in csvfiles:
filename.append(i.extract().get_text())
print(filename)