A reusable GitHub Action that performs pedagogical AI-based reviews of Python commits after they are created.
This Action is designed for learning and self-review. It intentionally runs after commits, not before, to avoid AI-driven code generation during development.
The OPENAI API is not free, you have to buy credits in the OPENAI platform to use this script
- Runs on every push
- Executes only if the commit message contains
[ai-commit-review-study] - Analyzes the commit diff
- Posts AI feedback directly as a comment on the commit
In your repository:
- Go to Settings → Secrets and variables → Actions
- Add a secret named: OPENAI_API_KEY
name: AI Commit Review For Study
on:
push:
jobs:
review:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '[ai-commit-review-study]')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: your-username/ai-commit-review-action@v1
with:
openai_api_key: ${{ secrets.OPENAI_API_KEY }}