CI/CD Integration
GitHub Actions
Run Shiro workflows in GitHub Actions for PR reviews, deployments, and automation.
Official GitHub Action
Use the official Shiro GitHub Action — no manual install needed:
yaml
.github/workflows/shiro.yml
name: Shiro Workflow
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
run-workflow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Shiro Workflow
uses: rajitk13/shiro-automation@master
env:
GITHUB_TOKEN: {{ secrets.GITHUB_TOKEN }}Action Inputs
| Input | Default | Description |
|---|---|---|
| workflow | .shiro/workflow.json | Path to workflow JSON file |
| config | .shiro/config.yaml | Path to config YAML file |
| shiro-dir | .shiro | Path to .shiro directory |
| state-store | memory | State storage backend (memory, filesystem) |
| fresh | false | Start fresh, ignore existing state |
| dry-run | false | Dry-run mode, validate without executing |
AI PR Review
Automatically review pull requests with AI using get_diff and the GitHub Action:
yaml
.github/workflows/ai-review.yml
name: AI PR Review
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
ai-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run AI Review
uses: rajitk13/shiro-automation@master
with:
workflow: .shiro/workflows/code-review.json
env:
GITHUB_TOKEN: {{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: {{ secrets.OPENAI_API_KEY }}Manual Install (Advanced)
If you need more control, install Shiro manually with architecture detection:
yaml
- name: Install Shiro
run: |
ARCH=$(uname -m)
[ "$ARCH" = "x86_64" ] && ARCH="amd64"
[ "$ARCH" = "aarch64" ] && ARCH="arm64"
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
curl -LO "https://github.com/rajitk13/shiro-automation/releases/latest/download/shiro-${OS}-${ARCH}"
chmod +x "shiro-${OS}-${ARCH}"
sudo mv "shiro-${OS}-${ARCH}" /usr/local/bin/shiro
- name: Run Workflow
env:
GITHUB_TOKEN: {{ secrets.GITHUB_TOKEN }}
run: shiro runWith State Storage
Use filesystem state store with artifacts:
yaml
- name: Run Shiro Workflow
uses: rajitk13/shiro-automation@master
with:
state-store: filesystem
env:
GITHUB_TOKEN: {{ secrets.GITHUB_TOKEN }}
- name: Upload State
uses: actions/upload-artifact@v4
with:
name: workflow-state
path: .shiro/state/GitHub Module Reference
The built-in github module supports three operations, all resolved from environment variables automatically.
| Operation | Required config fields | Output |
|---|---|---|
get_diff | none | diff (string) |
post_comment | body (string) | success, message |
post_inline_comments | body or comments, output_format, dedup | success, posted_count, skipped_count |
Required environment variables (all operations)
| GITHUB_TOKEN | GitHub token with repo and pull-requests write scope |
| GITHUB_REPOSITORY_OWNER | Repository owner |
| GITHUB_REPOSITORY | Full repository name (owner/repo) |
| GITHUB_PR_NUMBER | Pull request number (post operations) |
| GITHUB_SHA | Commit SHA — required for post_inline_comments |
post_inline_comments Config
| Field | Required | Description |
|---|---|---|
output_format | No | text (default) or json. Controls how comments are parsed from the AI output. |
body | text mode | Raw AI text output. Shiro parses file:line - comment patterns. |
comments | json mode | JSON array of {file, line, comment} objects from {{steps.STEP_ID.json}}. |
dedup | No | Boolean. Default true. Skips comments already posted on the PR. |
commit_id | No | Override commit SHA. Defaults to GITHUB_SHA env var. |
GitHub vs GitLab State
Note: The gitlab state store is GitLab-specific. For GitHub Actions, use filesystem with artifacts or memory for ephemeral workflows.