Skip to content

anthu/cortex-code-action

Repository files navigation

cortex-code-action

AI code review for data teams, powered by Cortex Code

License: MIT

A GitHub Action that uses Cortex Code to review your pull requests. Works for any codebase -- particularly useful for data engineering projects (SQL, dbt, Snowpark, Streamlit, Python pipelines).

Why

  • Security-first: SQL execution is permanently blocked. This action reviews code, it does not access your data. See docs/security.md.
  • Data-aware reviews: Cortex Code understands SQL patterns, dbt conventions, Snowpark idioms, and Streamlit apps out of the box.
  • Reuses your setup: The same Cortex Code CLI you use locally powers CI reviews. No separate model configuration.

Security at a glance

This action cannot execute SQL and cannot read sensitive files (~/.ssh, ~/.snowflake, .env, *.p8, credentials). These restrictions are enforced at runtime via the Cortex Code Agent SDK's canUseTool callback -- independent of prompts. No configuration can override them.

See docs/security.md for the full threat model and rationale.

Quick start

name: Cortex Code Review
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  review:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: anthu/[email protected]
        with:
          snowflake_private_key: ${{ secrets.SNOWFLAKE_PRIVATE_KEY }}
          snowflake_account: ${{ secrets.SNOWFLAKE_ACCOUNT }}
          snowflake_user: ${{ secrets.SNOWFLAKE_USER }}
          snowflake_role: "CODE_REVIEWER"

Tip: Create a dedicated low-privilege Snowflake service user for CI. It only needs SNOWFLAKE.CORTEX_USER database role -- no data access required.

Features

  • PR code review with structured feedback (summary, issues, suggestions, verdict)
  • @cortex mention interaction in PR comments
  • Auto-fix commits (opt-in via permissions: read-write)
  • Real-time progress tracking comment
  • Configurable per-project review instructions

Documentation

Topic Description
docs/security.md Threat model, full blocklist, canUseTool internals
docs/configuration.md All inputs, outputs, and secrets reference
docs/usage.md Modes, triggers, custom instructions
docs/auto-fix.md Read-write mode and auto-fix commits
docs/architecture.md How the Agent SDK gate works
docs/troubleshooting.md Common errors and debugging
docs/comparison.md vs claude-code-action, vs generic reviewers
docs/contributing.md Dev setup, testing, releasing

License

MIT © Anton Huck

About

AI code review for data teams, powered by Cortex Code

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors