This should be relative to a specific commit, as some files may be present in some commits and not in others, so before you can watch the files, you need to use something like the List of commits in the repository :
GET /repos/:owner/:repo/commits
If you are interested in the last commit on a branch, you can set the branch name for the sha parameter:
sha string SHA or branch to start enumerating commits from.
Once you have a commit hash, you can check what to commit
GET /repos/:owner/:repo/git/commits/:sha
which should return something like this (truncated from the GitHub documentation):
{ "sha": "...", "...", "tree": { "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb", "sha": "691272480426f78a0138979dd3ce63b77f706feb" }, "...": "..." }
Look at the hash of your tree, which is essentially its contents in the directory. In this case, 691272480426f78a0138979dd3ce63b77f706feb . Now we can request the contents of this tree :
GET /repos/:owner/:repo/git/trees/:sha
The result from the GitHub example is
{ "sha": "9fb037999f264ba9a7fc6274d15fa3ae2ab98312", "url": "https://api.github.com/repos/octocat/Hello-World/trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312", "tree": [ { "path": "file.rb", "mode": "100644", "type": "blob", "size": 30, "sha": "44b4fc6d56897b048c772eb4087f854f46256132", "url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132" }, { "path": "subdir", "mode": "040000", "type": "tree", "sha": "f484d249c660418515fb01c2b9662073663c242e", "url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/f484d249c660418515fb01c2b9662073663c242e" }, { "path": "exec_file", "mode": "100755", "type": "blob", "size": 75, "sha": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057", "url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/45b983be36b73c0788dc9cbcb76cbb80fc7bb057" } ] }
As you can see, we have some blob that correspond to files and some additional trees that correspond to subdirectories. You can do this recursively .