Skip to content
Open
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
2 changes: 1 addition & 1 deletion examples/gitflic_ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Go to **Settings → CI/CD → Variables** and add:
| `OCR_LLM_URL` | Yes | LLM API endpoint URL |
| `OCR_LLM_AUTH_TOKEN` | Yes | LLM API authentication token |
| `GITFLIC_TOKEN` | Yes | GitFlic access token used to post discussions |
| `OCR_LLM_MODEL` | No | Model name (e.g., `gpt-4o`) |
| `OCR_LLM_MODEL` | Yes | Model name (e.g., `gpt-4o`) — OCR has no built-in default model and fails when this is unset |
| `GITFLIC_API_URL` | No | REST API base URL for self-hosted GitFlic (default: `https://api.gitflic.ru`) |

> **Note:** GitFlic CI/CD does not accept variables with values shorter than 8 characters, so `use_anthropic` cannot be set as a CI variable. The pipeline sets it to `false`; to use Anthropic Claude models, edit `gitflic-ci.yaml` directly.
Expand Down
13 changes: 8 additions & 5 deletions examples/gitlab_ci/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
# Required CI/CD Variables (Settings → CI/CD → Variables):
# OCR_LLM_URL - LLM API endpoint (e.g., https://api.openai.com/v1/chat/completions)
# OCR_LLM_AUTH_TOKEN - Authentication token for the LLM API (mark as "Masked")
# OCR_LLM_MODEL - Model name (e.g., gpt-4o). OCR has no built-in default model; the
# pipeline fails fast if this is unset.
#
# Optional CI/CD Variables:
# OCR_LLM_MODEL - Model name (default: gpt-4o)
# GITLAB_API_TOKEN - GitLab Personal/Project Access Token with "api" scope
# (falls back to CI_JOB_TOKEN if not set)
#
Expand Down Expand Up @@ -48,12 +49,14 @@ code-review:
- echo "OpenCodeReview installed with version:" && ocr version || true

# Configure OCR
- mkdir -p ~/.open-code-review
# Gitlab CI/CD does not support configuring variables with value length less than 8, so you can't set use_anthropic as a CI variable
- |
ocr config set llm.url $OCR_LLM_URL
ocr config set llm.auth_token $OCR_LLM_AUTH_TOKEN
ocr config set llm.model $OCR_LLM_MODEL
: "${OCR_LLM_URL:?set OCR_LLM_URL in Settings -> CI/CD -> Variables}"
: "${OCR_LLM_AUTH_TOKEN:?set OCR_LLM_AUTH_TOKEN in Settings -> CI/CD -> Variables}"
: "${OCR_LLM_MODEL:?set OCR_LLM_MODEL in Settings -> CI/CD -> Variables}"
ocr config set llm.url "$OCR_LLM_URL"
ocr config set llm.auth_token "$OCR_LLM_AUTH_TOKEN"
ocr config set llm.model "$OCR_LLM_MODEL"
ocr config set llm.use_anthropic false
ocr config set llm.extra_body '{"thinking": {"type": "disabled"}}'

Expand Down
12 changes: 7 additions & 5 deletions examples/gitlab_ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Go to your project's **Settings → CI/CD → Variables** and add:
|----------|----------|--------|-------------|
| `OCR_LLM_URL` | Yes | No | LLM API endpoint URL (e.g., `https://api.openai.com/v1/chat/completions`) |
| `OCR_LLM_AUTH_TOKEN` | Yes | Yes | API authentication token |
| `OCR_LLM_MODEL` | No | No | Model name (defaults to `gpt-4o`) |
| `OCR_LLM_MODEL` | Yes | No | Model name (e.g., `gpt-4o`) — OCR has no built-in default model and fails when this is unset |
| `GITLAB_API_TOKEN` | No | Yes | GitLab access token with `api` scope (falls back to `CI_JOB_TOKEN` if not set) |

> **Note:** GitLab CI/CD does not support variables with values shorter than 8 characters, so `use_anthropic` cannot be set as a CI variable. The pipeline sets it to `false` by default. If you need to use Anthropic Claude models, you'll need to modify the `.gitlab-ci.yml` script directly.
Expand Down Expand Up @@ -145,11 +145,13 @@ script:
- npm install -g @alibaba-group/open-code-review

# Configure OCR
- mkdir -p ~/.open-code-review
- |
ocr config set llm.url $OCR_LLM_URL
ocr config set llm.auth_token $OCR_LLM_AUTH_TOKEN
ocr config set llm.model $OCR_LLM_MODEL
: "${OCR_LLM_URL:?set OCR_LLM_URL in Settings -> CI/CD -> Variables}"
: "${OCR_LLM_AUTH_TOKEN:?set OCR_LLM_AUTH_TOKEN in Settings -> CI/CD -> Variables}"
: "${OCR_LLM_MODEL:?set OCR_LLM_MODEL in Settings -> CI/CD -> Variables}"
ocr config set llm.url "$OCR_LLM_URL"
ocr config set llm.auth_token "$OCR_LLM_AUTH_TOKEN"
ocr config set llm.model "$OCR_LLM_MODEL"
ocr config set llm.use_anthropic false
ocr config set llm.extra_body '{"thinking": {"type": "disabled"}}'

Expand Down
Loading