I want to create a GitHub web hook that scans the names and contents of the files being committed, and disallows a commit if a specific token appears in either.
I have found the GitHub webhook documentation, and it is clear that there are many events that can be caught, including the push event. There is a lot of data available in the JSON object that is sent with the push event, including the commits array, which is "An array of commit objects describing the pushed commits. (The array includes a maximum of 20 commits. If necessary, you can use the Commits API to fetch additional commits. This limit is applied to timeline events only and isn't applied to webhook deliveries.)"
However, it is not clear how to turn this into a list of filenames and file contents.
How do I do that?