fix(examples): preserve Bitbucket OCR diagnostics (#486)

This commit is contained in:
a1212a11 authored and GitHub committed 2026-07-24 21:03:52 +08:00
1 parent 69e68a9317
commit 476f661f26
2 files changed
+16 -4

No files matched your search

+4 -3
View File
@@ -239,9 +239,10 @@ access the current repository and comment on its pull requests.
### OCR review produced no output
Verify `OCR_LLM_URL`, `OCR_LLM_AUTH_TOKEN`, and `OCR_LLM_MODEL`. Also confirm
that the destination branch was fetched and that the PR changes contain file
types supported by OCR.
The pipeline prints OCR stderr before failing. Use those diagnostics to verify
`OCR_LLM_URL`, `OCR_LLM_AUTH_TOKEN`, and `OCR_LLM_MODEL`. Also confirm that the
destination branch was fetched and that the PR changes contain file types
supported by OCR.
### Cannot find a merge base
@@ -58,12 +58,23 @@ definitions:
"+refs/heads/${BITBUCKET_PR_DESTINATION_BRANCH}:refs/remotes/origin/${BITBUCKET_PR_DESTINATION_BRANCH}"
- |
OCR_EXIT_CODE=0
ocr review \
--from "origin/${BITBUCKET_PR_DESTINATION_BRANCH}" \
--to "${BITBUCKET_COMMIT}" \
--format json \
--audience agent \
> /tmp/ocr-result.json || true
> /tmp/ocr-result.json 2> /tmp/ocr-stderr.log || OCR_EXIT_CODE=$?
if [ -s /tmp/ocr-stderr.log ]; then
echo "=== OCR stderr ==="
cat /tmp/ocr-stderr.log
fi
if [ "$OCR_EXIT_CODE" -ne 0 ]; then
echo "OCR review failed with exit code ${OCR_EXIT_CODE}."
exit "$OCR_EXIT_CODE"
fi
if [ ! -s /tmp/ocr-result.json ]; then
echo "OCR review produced no output."