递归文件和目录列出github

I`m looking for a way to list all files and directories of a github release

For example:

root
-> x.txt
-> folder1
   -> folder2
      -> file-0.txt
   -> file-1.txt

would return:

root/x.txt
root/folder1/file-1.txt
root/folder1/folder2/file-0.txt

Is there a way to do this directly with github api? if not with php and api?

In PHP:

function github_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: token  XXX_TOKEN"));
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); 
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
return curl_exec($ch);
}

$cache = github_curl("https://api.github.com/repos/LucLaverdure/Wizard.Build/releases/latest?client_secret=XXX_SECRET");
$cache = json_decode($cache, true);
$cache_file = $cache["zipball_url"];

// get zip file, build it if new
if (!file_exists(dirname(__FILE__)."/cache/".basename($cache_file).".zip")) {
    $cache_download = github_curl($cache_file);
    file_put_contents(dirname(__FILE__)."/cache/".basename($cache_file).".zip", $cache_download);
}


// list files within zip file (FTP ONLY)
$zip = new ZipArchive; 
if ($zip->open(dirname(__FILE__)."/cache/".basename($cache_file).".zip") == TRUE) {
 for ($i = 0; $i < $zip->numFiles; $i++) {
     $filename = $zip->getNameIndex($i);
     echo $filename."<br>";
 }
}

Voila!

Neither the repo content API nor the release API would enumerate files.
To get a repo content, you might need to use the Tree API

But for a release (which can include a zip file or any other asset), you would need something like aatishnn/lszip: a way to list a remote archive content (here with python).

    -