A GitHub/GitLab post-receive hook - receiver, written as a Flask application.
Whenever you push code to a GitHub/GitLab repository, with a post-receive hook configured to point at Receipt, the scripts found for the repository and branch will be executed.
If you for instance have configured the scripts directory parameter to scripts and do a push to the master branch in the backend repository, the scripts found within the directories at scripts/backend and scripts/backend/master will be executed.
Receipt will execute the scripts the same way if you entered ./script.sh within a shell, except the default interpreter won't be whichever shell you are using. This generally means you need to include an interpreter on the first line of the script, using the Shebang syntax or use a binary file.
The program will be called with the repository name as the first argument and branch name as the second. The full JSON payload will be sent to standard input of the program. An example of the payload can be see in the GitHub and GitLab documentations.
The scripts will be executed as the same user Receipt is running as, if you want to run a script with other permissions, then either use the setuid bit, or make a shell script which calls sudo.
Receipt is available under the MIT license.