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

InputDefaultDescription
workflow.shiro/workflow.jsonPath to workflow JSON file
config.shiro/config.yamlPath to config YAML file
shiro-dir.shiroPath to .shiro directory
state-storememoryState storage backend (memory, filesystem)
freshfalseStart fresh, ignore existing state
dry-runfalseDry-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 run

With 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.

OperationRequired config fieldsOutput
get_diffnonediff (string)
post_commentbody (string)success, message
post_inline_commentsbody or comments, output_format, dedupsuccess, posted_count, skipped_count

Required environment variables (all operations)

GITHUB_TOKENGitHub token with repo and pull-requests write scope
GITHUB_REPOSITORY_OWNERRepository owner
GITHUB_REPOSITORYFull repository name (owner/repo)
GITHUB_PR_NUMBERPull request number (post operations)
GITHUB_SHACommit SHA — required for post_inline_comments

post_inline_comments Config

FieldRequiredDescription
output_formatNotext (default) or json. Controls how comments are parsed from the AI output.
bodytext modeRaw AI text output. Shiro parses file:line - comment patterns.
commentsjson modeJSON array of {file, line, comment} objects from {{steps.STEP_ID.json}}.
dedupNoBoolean. Default true. Skips comments already posted on the PR.
commit_idNoOverride 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.