An intelligent commit analysis tool that provides insights and coaching for code changes.
Analyzes commits and provides intelligent insights like:
- "You added ~120 lines but didn't write tests for module X"
- "You removed public method foo() - are downstream consumers affected?"
- "You added feature flags - consider documenting them"
- "This is a large commit (300+ lines) - consider breaking it up"
See Commit Coach in action with real git workflows:
Once published to the GitHub Marketplace, you'll be able to install with one click or use:
name: Commit Coach on: [push, pull_request] jobs: commit-coach: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: rasterandstate/commit-coach@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }}For now, you can use the action directly from the repository:
name: Commit Coach on: [push, pull_request] jobs: commit-coach: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: rasterandstate/commit-coach@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }}# Install from source (after cloning the repository) npm install npm run build # Initialize config ./dist/index.js init # Analyze current commit ./dist/index.js analyze # GitHub integration ./dist/index.js github --pr 123Create .commit-coach.yml:
rules: - id: missing-tests enabled: true severity: warning conditions: ["sourceFilesWithoutTests.length > 0"] message: "Consider adding tests for new/modified source files" output: format: console # console, comment, status-check, report maxInsights: 10 integrations: github: token: "${GITHUB_TOKEN}" commentOnPR: true createStatusCheck: trueThis project uses Lefthook for git hooks to ensure code quality:
- Formatting: Runs Prettier to check code formatting
- Linting: Runs ESLint to check code quality
- Type Checking: Runs TypeScript compiler to check types
- Tests: Runs tests for changed files
- Build: Ensures the project compiles successfully
- Test Coverage: Runs full test suite with coverage
- Action Build: Builds the GitHub Action
# Install hooks (done automatically after npm install) npm run hooks:install # Run hooks manually npm run hooks:run pre-commit npm run hooks:run pre-push # Uninstall hooks npm run hooks:uninstall- Hardcoded Secrets: Detects API keys, tokens, and credentials
- Security Patterns: Identifies potential security vulnerabilities
- Test Coverage: Warns when source files lack tests
- Code Quality: Analyzes code patterns and quality metrics
- Large Commits: Warns about large commits (200+ lines)
- Commit Messages: Flags short or unclear commit messages
- TODO Comments: Detects TODO/FIXME comments in code
- Public API Changes: Detects API removals and new APIs
- Documentation: Suggests updating docs for new features
- Feature Flags: Identifies new feature flags that need documentation
- Breaking Changes: Detects potential breaking changes
π Complete Rules Documentation - Learn how to create custom rules and configure all available options.
π Configuration Examples - See practical examples for different project types and team workflows.
- π Documentation Index - Complete documentation overview
- π Rules Reference - All available variables, conditions, and examples
- π Configuration Examples - Project-specific configurations
- π Usage Examples - Command-line usage and CI/CD integration
| Input | Description | Required | Default |
|---|---|---|---|
github-token | GitHub token for API access | β | - |
config-path | Path to commit-coach config file | β | .commit-coach.yml |
commit-hash | Specific commit to analyze | β | Current commit |
pr-number | Pull request number | β | Auto-detected |
comment | Post comment on PR | β | true |
status-check | Create status check | β | true |
MIT License - see LICENSE file for details. .
