This repository contains a Flask application that receives GitHub webhooks and stores them in MongoDB.
-
Clone the repository
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Set up MongoDB:
- Create a
.envfile in the root directory - Add your MongoDB URI:
MONGO_URI=your_mongodb_connection_string
- Create a
-
Configure GitHub Webhooks:
- Go to your GitHub repository settings
- Click on "Webhooks"
- Add webhook:
- Payload URL:
http://your-domain/webhook/receiver - Content type:
application/json - Select events: Push, Pull Request, Merge
- Payload URL:
-
Run the application:
python run.py
The application handles the following GitHub events:
Format: {author} pushed to {to_branch} on {timestamp}
Example: "Travis" pushed to "staging" on 1st April 2021 - 9:30 PM UTC
Format: {author} submitted a pull request from {from_branch} to {to_branch} on {timestamp}
Example: "Travis" submitted a pull request from "staging" to "master" on 1st April 2021 - 9:00 AM UTC
Format: {author} merged branch {from_branch} to {to_branch} on {timestamp}
Example: "Travis" merged branch "dev" to "master" on 2nd April 2021 - 12:00 PM UTC
{
"_id": "ObjectId",
"request_id": "string",
"author": "string",
"action": "string",
"from_branch": "string",
"to_branch": "string",
"timestamp": "string/datetime"
}