This project is a developer-focused automation tool that listens for GitHub webhooks and posts meaningful summaries of your commit history directly to your Hashnode Journal as drafts.
Built with FastAPI, OpenAI GPT-4, and the Hashnode GraphQL API, it turns commit messages into clean blog entries without ever leaving your terminal.
- Receives GitHub webhooks for push events
- Filters commits (including merges)
- Generates clean summaries using GPT-4
- Posts as draft entries in your Hashnode Journal
- Deployable on platforms like Railway or Render
- Easily extendable for multiple repositories (coming soon)
- Async processing to prevent webhook timeout errors
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-namepip install -r requirements.txtCreate a .env file in your project root with:
HASHNODE_TOKEN=your_hashnode_personal_access_token
PUBLICATION_ID=your_hashnode_publication_id
OPENAI_API_KEY=your_openai_api_key- Go to https://platform.openai.com/account/api-keys
- Click "Create new secret key"
- Copy and paste into your
.envasOPENAI_API_KEY
- Go to https://hashnode.com/settings/developer
- Click Generate New Token
- Copy it and add to
.envasHASHNODE_TOKEN
- Run this GraphQL query:
query {
me {
publications(first: 1) {
edges {
node {
id
title
}
}
}
}
}You can test this with curl:
curl -X POST https://gql.hashnode.com \
-H "Content-Type: application/json" \
-H "Authorization: YOUR_HASHNODE_TOKEN" \
-d '{"query": "{ me { publications(first: 1) { edges { node { id title } } } } }"}'Find your publication id in the response and paste it into .env as PUBLICATION_ID.
- GitHub pushes a commit → webhook sends data to
/webhook - FastAPI receives payload and filters commits
- Each commit is summarized using GPT-4
- Each summary is posted as a draft to your Hashnode Journal
uvicorn main:app --host 0.0.0.0 --port 8000This makes your app accessible on your local network using your computer's IP.
- On Windows:
ipconfig - On macOS/Linux:
ifconfig
Use the IP with the port 8000 in your webhook URL:
http://192.168.x.x:8000/webhook
- Push your project to GitHub
- Go to https://railway.app
- Create a new project → Deploy from GitHub
- Add your
.envvariables under "Variables" - Set the start command:
uvicorn main:app --host 0.0.0.0 --port 8000
- Go to your GitHub repo → Settings → Webhooks
- Click "Add webhook"
- Payload URL:
https://your-deployment-url.com/webhook - Content type:
application/json - Events: Just the push event
- Save
GitHub will now POST to your FastAPI app on each push.
Title:
my-username/my-repo – Committed: Refactor generate_summary function for clarity
Summary:
This update improves the clarity of the `generate_summary` function by breaking up long lines and adding inline documentation. It helps future contributors understand how summaries are generated.
- ✅ Support multiple repositories → journals
- ✅ Custom tags per commit type (e.g., #fix, #feature, #docs)
- ✅ Full post publishing (not just drafts)
- ✅ Weekly commit roundups
- ✅ Frontend dashboard to manage journals
- ✅ Discord/Telegram notification integration
- ✅ Logging to file/database
- ✅ Retry logic for failed posts
- ✅ GitHub Actions integration for tighter automation
MIT
