diff --git a/pages/src/content/docs/en/integrations/ci.md b/pages/src/content/docs/en/integrations/ci.md index bbdd079b..440d42c1 100644 --- a/pages/src/content/docs/en/integrations/ci.md +++ b/pages/src/content/docs/en/integrations/ci.md @@ -120,24 +120,37 @@ semantic convention like `feat(auth): add OAuth2 support`): ```yaml - name: Run OCR review + env: + PR_TITLE: ${{ github.event.pull_request.title }} + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | ocr review \ - --background "${{ github.event.pull_request.title }}" \ - --from "origin/${{ github.base_ref }}" \ - --to "origin/${{ github.head_ref }}" \ + --background "$PR_TITLE" \ + --from "origin/$BASE_REF" \ + --to "origin/$HEAD_REF" \ --format json --audience agent ``` +Pass PR-controlled values through `env:` rather than +interpolating `${{ }}` directly into `run:`. GitHub substitutes +`${{ }}` textually *before* the shell parses the line, so a PR +title or branch name containing shell metacharacters would +execute on your runner. + #### Custom rules Pass a project-specific rule file with `--rule`: ```yaml - name: Run OCR review + env: + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | ocr review --rule ./my-rules.json \ - --from "origin/${{ github.base_ref }}" \ - --to "origin/${{ github.head_ref }}" + --from "origin/$BASE_REF" \ + --to "origin/$HEAD_REF" ``` See [Review Rules](../../review-rules/) for the schema. @@ -149,10 +162,13 @@ to stay under your LLM provider's rate limits: ```yaml - name: Run OCR review + env: + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | ocr review --concurrency 5 \ - --from "origin/${{ github.base_ref }}" \ - --to "origin/${{ github.head_ref }}" + --from "origin/$BASE_REF" \ + --to "origin/$HEAD_REF" ``` #### Trigger pattern diff --git a/pages/src/content/docs/ja/integrations/ci.md b/pages/src/content/docs/ja/integrations/ci.md index 4d071cdf..c9a38122 100644 --- a/pages/src/content/docs/ja/integrations/ci.md +++ b/pages/src/content/docs/ja/integrations/ci.md @@ -83,24 +83,33 @@ curl -o .github/workflows/ocr-review.yml \ ```yaml - name: Run OCR review + env: + PR_TITLE: ${{ github.event.pull_request.title }} + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | ocr review \ - --background "${{ github.event.pull_request.title }}" \ - --from "origin/${{ github.base_ref }}" \ - --to "origin/${{ github.head_ref }}" \ + --background "$PR_TITLE" \ + --from "origin/$BASE_REF" \ + --to "origin/$HEAD_REF" \ --format json --audience agent ``` +PR で制御可能な値は `${{ }}` を `run:` に直接展開するのではなく、`env:` 経由で渡してください。GitHub は `${{ }}` を shell が行を解析する *前に* テキストとして置換するため、shell のメタ文字を含む PR タイトルやブランチ名が runner 上で実行されてしまいます。 + #### カスタムルール `--rule` でプロジェクト固有のルールファイルを渡します。 ```yaml - name: Run OCR review + env: + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | ocr review --rule ./my-rules.json \ - --from "origin/${{ github.base_ref }}" \ - --to "origin/${{ github.head_ref }}" + --from "origin/$BASE_REF" \ + --to "origin/$HEAD_REF" ``` スキーマは[レビュールール](../../review-rules/)を参照してください。 @@ -111,10 +120,13 @@ curl -o .github/workflows/ocr-review.yml \ ```yaml - name: Run OCR review + env: + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | ocr review --concurrency 5 \ - --from "origin/${{ github.base_ref }}" \ - --to "origin/${{ github.head_ref }}" + --from "origin/$BASE_REF" \ + --to "origin/$HEAD_REF" ``` #### トリガーモード diff --git a/pages/src/content/docs/zh/integrations/ci.md b/pages/src/content/docs/zh/integrations/ci.md index dfd811a4..4216a9ab 100644 --- a/pages/src/content/docs/zh/integrations/ci.md +++ b/pages/src/content/docs/zh/integrations/ci.md @@ -101,24 +101,35 @@ curl -o .github/workflows/ocr-review.yml \ ```yaml - name: Run OCR review + env: + PR_TITLE: ${{ github.event.pull_request.title }} + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | ocr review \ - --background "${{ github.event.pull_request.title }}" \ - --from "origin/${{ github.base_ref }}" \ - --to "origin/${{ github.head_ref }}" \ + --background "$PR_TITLE" \ + --from "origin/$BASE_REF" \ + --to "origin/$HEAD_REF" \ --format json --audience agent ``` +把 PR 可控的值通过 `env:` 传入,不要把 `${{ }}` 直接插值进 `run:`。GitHub 在 +shell 解析该行 *之前* 就已把 `${{ }}` 做了文本替换,因此包含 shell 元字符的 PR +标题或分支名会在你的 runner 上被执行。 + #### 自定义规则 用 `--rule` 传入项目专属规则文件: ```yaml - name: Run OCR review + env: + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | ocr review --rule ./my-rules.json \ - --from "origin/${{ github.base_ref }}" \ - --to "origin/${{ github.head_ref }}" + --from "origin/$BASE_REF" \ + --to "origin/$HEAD_REF" ``` schema 见[评审规则](../../review-rules/)。 @@ -129,10 +140,13 @@ schema 见[评审规则](../../review-rules/)。 ```yaml - name: Run OCR review + env: + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | ocr review --concurrency 5 \ - --from "origin/${{ github.base_ref }}" \ - --to "origin/${{ github.head_ref }}" + --from "origin/$BASE_REF" \ + --to "origin/$HEAD_REF" ``` #### 触发模式