Zero-config code health checks for your pull requests π
Automatically analyze your repository and post maintainability metrics on every PR. No configuration needed β just drop it in your workflow.
Shift-left code quality β catch maintainability issues before they reach production.
- β Instant feedback β developers see health metrics within seconds on PRs
- β Preventative maintenance β block merges when quality drops below thresholds
- β No configuration required β works out of the box with sensible defaults
- β Language agnostic β analyzes Python, JavaScript, TypeScript, Go, Rust, Java, and more
- β Fast & cached β pipx dependencies cached between runs (~5-8s after first run)
- β Non-intrusive β sticky PR comments (updates in place, no spam)
Use cases:
- Enforce maintainability standards across teams
- Monitor tech debt trends in CI
- Gate releases on code health thresholds
- Onboard new contributors with clear quality metrics
- β Automatic PR comments with health metrics
- β Sticky updates β no comment spam
- β CI quality gates with configurable thresholds
- β Fast caching β pipx packages cached between runs
- β Rich outputs β use metrics in other workflow steps
- β Zero config β works out of the box
Add this to .github/workflows/devscope.yml:
name: Code Health
on:
pull_request:
push:
branches: [main]
jobs:
health-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for git metrics
- uses: EhsanAzish80/devscope-action@v1That's it! π
Example PR Comment:
π Devscope Report
Maintainability: π’ B
Risk: π’ Low
Onboarding: Easy
β‘ 0.82s
<details>
<summary>Full summary βΌ</summary>
βββββββββββββββββββββββββββββββββββββββ
Devscope: B Β· Low risk Β· Easy onboarding Β· 0.78 tests Β· 0.82s β‘
Files: 1,247
Lines: 45,892
Languages: Python (45%) Β· TypeScript (33%) Β· JavaScript (12%)
**Metrics:**
- Maintainability Grade: B (82.5/100)
- Risk Level: Low
- Onboarding Difficulty: Easy
- Test Coverage: 78%
Analyze your repo β `pipx install devscope`
Updated: Thu, 13 Feb 2026 15:30:00 GMT
</details>
Features:
- β Emoji indicators π’ green (good), π΄ red (critical)
- β Sticky updates (edits same comment, no spam)
- β Collapsible full summary
- β Performance timing
Fail the workflow if maintainability drops below B:
- uses: EhsanAzish80/devscope-action@v1
with:
fail-under: B
max-risk: Medium
max-onboarding: ModerateExit codes:
0= All thresholds passed1= Runtime error2= Threshold violated (fails CI)
- uses: EhsanAzish80/devscope-action@v1
with:
path: ./src- uses: EhsanAzish80/devscope-action@v1
id: devscope
- name: Check grade
run: |
echo "Grade: ${{ steps.devscope.outputs.grade }}"
echo "Risk: ${{ steps.devscope.outputs.risk }}"
if [ "${{ steps.devscope.outputs.grade }}" == "F" ]; then
echo "::warning::Code health is critical!"
fiFor private repos or fine-grained permissions:
- uses: EhsanAzish80/devscope-action@v1
with:
github-token: ${{ secrets.CUSTOM_PAT }}| Input | Description | Default | Required |
|---|---|---|---|
path |
Directory to analyze | . |
No |
fail-under |
Minimum grade (A, B, C, D, F) | (none) | No |
max-risk |
Maximum risk level (Low, Medium, High) | (none) | No |
max-onboarding |
Max onboarding difficulty (Easy, Moderate, Hard) | (none) | No |
github-token |
GitHub token for PR comments | ${{ github.token }} |
No |
| Output | Description | Example |
|---|---|---|
health |
Overall health score (0-100) | 82.5 |
risk |
Risk level | Low |
onboarding |
Onboarding difficulty | Easy |
grade |
Maintainability grade | B |
The action posts a beautifully formatted comment on PRs:
Collapsed view:
π Devscope Report
Maintainability: π’ B
Risk: π’ Low
Onboarding: Easy
β‘ 0.82s
Expanded view:
π Devscope Report
Maintainability: π’ B
Risk: π’ Low
Onboarding: Easy
β‘ 0.82s
Full summary βΌ
βββββββββββββββββββββββββββββββββββββββ
Devscope: B Β· Low risk Β· Easy onboarding Β· 0.78 tests Β· 0.82s β‘
Files: 1,247
Lines: 45,892
Languages: Python (45%) Β· TypeScript (33%) Β· JavaScript (12%)
Analyze your repo β pipx install devscope
Updated: Thu, 13 Feb 2026 15:30:00 GMT
Features:
- β Emoji indicators (π’ green = good, π΄ red = bad)
- β Sticky updates (same comment, no spam)
- β Collapsible full summary
- β Timestamp tracking
name: Code Quality
on:
pull_request:
push:
branches: [main, develop]
jobs:
health-check:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for git metrics
- name: Run Devscope
uses: EhsanAzish80/devscope-action@v1
id: devscope
with:
fail-under: B
max-risk: Medium
- name: Upload metrics
if: always()
run: |
echo "Health: ${{ steps.devscope.outputs.health }}"
echo "Grade: ${{ steps.devscope.outputs.grade }}"
echo "Risk: ${{ steps.devscope.outputs.risk }}"jobs:
health-check:
strategy:
matrix:
service: [frontend, backend, shared]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: EhsanAzish80/devscope-action@v1
with:
path: ./services/${{ matrix.service }}
fail-under: C- uses: EhsanAzish80/devscope-action@v1
with:
fail-under: ${{ github.ref == 'refs/heads/main' && 'A' || 'B' }}
max-risk: ${{ github.ref == 'refs/heads/main' && 'Low' || 'Medium' }}This action uses aggressive caching for fast runs:
| Phase | First Run | Cached Runs |
|---|---|---|
| Setup Python | ~5s | ~2s (cached) |
| Install devscope | ~10-15s | ~3-5s (pipx cache) |
| Analysis | ~0.5-2s | ~0.5-2s |
| Total | ~15-20s | ~5-8s β‘ |
Optimization tips:
- Use
fetch-depth: 0for accurate git metrics - Enable pipx caching (automatic in this action)
- Run on push + PR for best cache hits
Most runs complete in under 10 seconds after initial setup β‘
permissions:
contents: read # Read repository code
pull-requests: write # Post PR commentsMinimal setup:
jobs:
health-check:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: EhsanAzish80/devscope-action@v1If you want to support PRs from forks:
on:
pull_request_target: # Use with caution!
permissions:
contents: read
pull-requests: writepull_request_target runs with write access. Only use if you trust fork contributors or implement additional checks.
Check permissions:
permissions:
pull-requests: writeVerify trigger:
on:
pull_request: # Must include thisThe action installs devscope automatically. If it fails:
- Check Python version (requires 3.9+)
- Clear cache: Go to Actions β Caches β Delete all caches
- Re-run workflow
Thresholds only apply on push events, not PRs. PRs show metrics but don't fail.
To enforce on PRs:
on:
pull_request:
push:
branches: [main]Enable caching:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Faster git operationsThis action follows semantic versioning:
@v1β Latest v1.x.x (recommended, auto-updates)@v1.0.0β Exact version (pinned, no updates)@mainβ Latest commit (unstable, for testing)
Recommended:
- uses: EhsanAzish80/devscope-action@v1This action:
- Installs devscope via pipx
- Caches Python dependencies for speed
- Analyzes your codebase (Python, JS, TS, Go, Rust, Java, etc.)
- Posts formatted PR comments
- Enforces quality gates on push events
- Provides structured outputs for custom workflows
Contributions welcome! Please:
- Fork the repo
- Create a feature branch
- Test locally with act
- Submit a PR
Local testing:
# Install act
brew install act
# Test workflow
act pull_request -j health-checkMIT License - see LICENSE file.
Built with:
- devscope β The analysis engine
- actions/github-script β PR comment management
- actions/setup-python β Python setup with caching
- π Report a bug
- π‘ Request a feature
- π¬ Discussions