mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-07-09 17:28:58 +00:00
chore: update ci pipeline examples (#45)
* chore: remove --audience agent flag and simplify JSON parsing in CI examples - Remove --audience agent flag from ocr review commands in CI examples - Simplify JSON output parsing by reading directly without skipping first line - Update README docs to reflect the simplified CLI usage * fix: correct typo in .gitlab-ci.yml comment Change 'confuring' to 'setting' in CI variable configuration comment.
This commit is contained in:
parent
e48b132ebf
commit
55c6bca1f8
5 changed files with 9 additions and 16 deletions
|
|
@ -208,11 +208,10 @@ The core command for CI integration:
|
|||
ocr review \
|
||||
--from "origin/main" \
|
||||
--to "origin/feature-branch" \
|
||||
--format json \
|
||||
--audience agent
|
||||
--format json
|
||||
```
|
||||
|
||||
The `--format json` and `--audience agent` flags output machine-readable results suitable for parsing in CI scripts.
|
||||
The `--format json` flag outputs machine-readable results suitable for parsing in CI scripts.
|
||||
|
||||
See the [`examples/`](./examples/) directory for integration examples:
|
||||
|
||||
|
|
|
|||
|
|
@ -208,11 +208,10 @@ CI 集成的核心命令:
|
|||
ocr review \
|
||||
--from "origin/main" \
|
||||
--to "origin/feature-branch" \
|
||||
--format json \
|
||||
--audience agent
|
||||
--format json
|
||||
```
|
||||
|
||||
`--format json` 和 `--audience agent` 参数输出适合 CI 脚本解析的机器可读结果。
|
||||
`--format json` 参数输出适合 CI 脚本解析的机器可读结果。
|
||||
|
||||
集成示例请参见 [`examples/`](./examples/) 目录:
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ jobs:
|
|||
--from "origin/${BASE_REF}" \
|
||||
--to "origin/${HEAD_REF}" \
|
||||
--format json \
|
||||
--audience agent \
|
||||
> /tmp/ocr-result.json 2>/tmp/ocr-stderr.log || true
|
||||
|
||||
echo "OCR review completed. Output:"
|
||||
|
|
@ -111,12 +110,11 @@ jobs:
|
|||
const fs = require('fs');
|
||||
const path = '/tmp/ocr-result.json';
|
||||
|
||||
// Read OCR output (skip first line which is not valid JSON)
|
||||
// Read OCR output
|
||||
let result;
|
||||
try {
|
||||
const raw = fs.readFileSync(path, 'utf8');
|
||||
const jsonContent = raw.substring(raw.indexOf('\n') + 1);
|
||||
result = JSON.parse(jsonContent);
|
||||
result = JSON.parse(raw);
|
||||
} catch (e) {
|
||||
console.log('Failed to parse OCR output:', e.message);
|
||||
// Post a simple comment if parsing fails
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ code-review:
|
|||
|
||||
# Configure OCR
|
||||
- mkdir -p ~/.open-code-review
|
||||
# Gitlab CI/CD does not support confuring variables with value length less than 8, so you can't set use_anthropic as a CI variable
|
||||
# Gitlab CI/CD does not support setting 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
|
||||
|
|
@ -42,7 +42,6 @@ code-review:
|
|||
--from "origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" \
|
||||
--to "origin/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" \
|
||||
--format json \
|
||||
--audience agent \
|
||||
> /tmp/ocr-result.json 2>/tmp/ocr-stderr.log || true
|
||||
echo "OCR review completed."
|
||||
cat /tmp/ocr-result.json
|
||||
|
|
@ -139,10 +138,9 @@ code-review:
|
|||
|
||||
# --- Main ---
|
||||
|
||||
# Read OCR result (skip first line which is summary, not JSON)
|
||||
# Read OCR result
|
||||
try:
|
||||
with open("/tmp/ocr-result.json", "r") as f:
|
||||
next(f) # Skip first line
|
||||
result = json.load(f)
|
||||
except (FileNotFoundError, json.JSONDecodeError) as e:
|
||||
print(f"Failed to parse OCR output: {e}", file=sys.stderr)
|
||||
|
|
|
|||
|
|
@ -172,8 +172,7 @@ script:
|
|||
"ocr", "review",
|
||||
"--from", f"origin/{TARGET_BRANCH}",
|
||||
"--to", f"origin/{SOURCE_BRANCH}",
|
||||
"--format", "json",
|
||||
"--audience", "agent"
|
||||
"--format", "json"
|
||||
], capture_output=True, text=True)
|
||||
|
||||
# Save output for the posting script
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue