Skip to content

Latest commit

 

History

History
99 lines (83 loc) · 2.04 KB

File metadata and controls

99 lines (83 loc) · 2.04 KB

Usage Examples

Basic Commands

# Analyze current commit
commit-coach analyze

# Analyze specific commit
commit-coach analyze --commit abc123

# Different output formats
commit-coach analyze --output report > analysis.json
commit-coach analyze --output comment

GitHub Integration

# Post to specific PR
commit-coach github --pr 123

# Auto-detect PR from commit
commit-coach github --commit abc123

# Only create status check (no comment)
commit-coach github --pr 123 --no-comment

CI/CD Examples

GitHub Actions Marketplace (Recommended)

name: Commit Coach
on: [push, pull_request]
jobs:
  commit-coach:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - uses: your-org/commit-coach@v1
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
        config-path: '.commit-coach.yml'  # optional

Note: Replace your-org/commit-coach@v1 with the actual action reference once published to the marketplace.

Manual GitHub Actions Setup

- name: Run Commit Coach
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  run: |
    if [ "${{ github.event_name }}" = "push" ]; then
      pnpm run coach github -- --commit ${{ github.sha }}
    fi
    if [ "${{ github.event_name }}" = "pull_request" ]; then
      pnpm run coach github -- --pr ${{ github.event.number }}
    fi

GitLab CI

commit-coach:
  stage: test
  image: node:24
  before_script:
    - npm install -g pnpm
  script:
    - pnpm run coach github -- --commit $CI_COMMIT_SHA
  only:
    - merge_requests
    - main

Configuration Examples

Custom Rules

rules:
  - id: security-check
    enabled: true
    severity: error
    conditions: ["diff.includes('password')"]
    message: "Potential password exposure detected"

Project-Specific Rules

rules:
  - id: frontend-tests
    enabled: true
    severity: warning
    conditions: ["file.path.includes('src/components/') && !hasTestFile"]
    message: "React components should have tests"