Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions .github/actions/cora-review/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Cora AI Code Review'
description: 'Run cora AI code review on a PR diff — uploads SARIF to Code Scanning and posts a PR comment.'
description: 'Run cora AI code review on a PR diff — posts a PR comment. SARIF upload is optional.'

inputs:
base-branch:
Expand All @@ -10,6 +10,14 @@ inputs:
description: 'Minimum severity to report (info, minor, major, critical)'
required: false
default: 'major'
cora-version:
description: 'cora-cli version tag (default: latest release)'
required: false
default: 'latest'
upload-sarif:
description: 'Upload SARIF to GitHub Code Scanning (default: false)'
required: false
default: 'false'
infisical-identity-id:
description: 'Infisical OIDC identity ID (from secret INFISICAL_IDENTITY_ID)'
required: true
Expand Down Expand Up @@ -41,11 +49,31 @@ runs:
env-slug: ${{ inputs.infisical-env }}
domain: ${{ inputs.infisical-domain }}

- name: Install cora-cli
shell: bash
run: |
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ASSET="cora-x86_64-unknown-linux-gnu"
elif [ "$ARCH" = "aarch64" ]; then
ASSET="cora-aarch64-unknown-linux-gnu"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
curl -sL "https://github.com/ajianaz/cora-cli/releases/download/${{ inputs.cora-version }}/${ASSET}-${{ inputs.cora-version }}.tar.gz" | tar xz -C /usr/local/bin cora
chmod +x /usr/local/bin/cora
cora --version

- name: Run cora review
id: review
shell: bash
env:
CORA_API_KEY: ${{ env.CORA_API_KEY }}
CORA_BASE_URL: ${{ env.CORA_BASE_URL }}
CORA_MODEL: ${{ env.CORA_MODEL }}
run: |
cargo build --release
./target/release/cora review \
cora review \
--base ${{ inputs.base-branch }} \
--format sarif \
--severity ${{ inputs.severity }} \
Expand All @@ -54,7 +82,8 @@ runs:
echo "Cora review complete ($(wc -c < cora-results.sarif) bytes)"

- name: Upload SARIF to GitHub Code Scanning
if: always() && hashFiles('cora-results.sarif') != ''
if: inputs.upload-sarif == 'true'
continue-on-error: true
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: cora-results.sarif
Expand Down Expand Up @@ -162,7 +191,7 @@ runs:
" 2>/dev/null || echo "0")

if [ "$ERRORS" -gt 0 ]; then
echo "::error::Cora found $ERRORS blocking issue(s). Review the Code Scanning results."
echo "::error::Cora found $ERRORS blocking issue(s)."
exit 1
fi
fi
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ jobs:
if: runner.os != 'Windows'
run: |
mkdir -p release
cp target/${{ matrix.target }}/release/cora release/${{ matrix.artifact }}
cp target/${{ matrix.target }}/release/cora release/cora
cd release
tar czf ${{ matrix.artifact }}-${{ steps.version.outputs.VERSION }}.${{ matrix.ext }} ${{ matrix.artifact }}
tar czf ${{ matrix.artifact }}-${{ steps.version.outputs.VERSION }}.${{ matrix.ext }} cora

- name: Package (Windows)
if: runner.os == 'Windows'
Expand Down Expand Up @@ -151,19 +151,21 @@ jobs:

| Platform | File |
|----------|------|
| Linux (x86_64) | `cora-VERSION-x86_64-unknown-linux-gnu.tar.gz` |
| Linux (ARM64) | `cora-VERSION-aarch64-unknown-linux-gnu.tar.gz` |
| macOS (Apple Silicon) | `cora-VERSION-aarch64-apple-darwin.tar.gz` |
| Windows (x86_64) | `cora-VERSION-x86_64-pc-windows-msvc.zip` |
| Linux (x86_64) | `cora-x86_64-unknown-linux-gnu-VERSION.tar.gz` |
| Linux (ARM64) | `cora-aarch64-unknown-linux-gnu-VERSION.tar.gz` |
| macOS (Apple Silicon) | `cora-aarch64-apple-darwin-VERSION.tar.gz` |
| Windows (x86_64) | `cora-x86_64-pc-windows-msvc-VERSION.zip` |

### 🚀 Quick Start

```bash
# Install via cargo
cargo install cora

# Or download binary
curl -fsSL https://github.com/ajianaz/cora-cli/releases/latest/download/cora-x86_64-unknown-linux-gnu-v0.1.1.tar.gz | tar xz
# Or download binary (extracts as 'cora')
curl -fsSL https://github.com/ajianaz/cora-cli/releases/latest/download/cora-x86_64-unknown-linux-gnu-VERSION.tar.gz | tar xz
chmod +x cora
sudo mv cora /usr/local/bin/

# Init project
cora init
Expand Down
Loading