For obvious reasons, GitHub won’t allow you to execute arbitrary code on their servers as part of Git hooks. The only hooking they allow is through their webhooks or the integrated third-party services.
If you need to run some custom code, you will have to host that somewhere and set up a webhook to run it on your own server.