Skip to content

Commit 2108efd

Browse files
authored
Merge pull request #65 from kacper-mikolajczak/claude-review-toolkit-readme-schema-path
Document safe schema-extension pattern in claude-review-toolkit README
2 parents 43c1b43 + 247aed8 commit 2108efd

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • .github/actions/claude-review-toolkit

.github/actions/claude-review-toolkit/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,19 @@ Caller repos must ship a `.claude/skills/coding-standards/rules/` directory with
4848

4949
## Schema extension
5050

51-
Repos that need extra fields on top of the canonical schema should `jq`-merge them in a follow-up step before feeding `claude_args`:
51+
Repos that need extra fields on top of the canonical schema should `jq`-merge them in a follow-up step before feeding `claude_args`. Read the canonical schema from `schema_path` (a file) rather than piping `schema_json` through `echo`, so the shell never sees the schema's `"` characters:
5252

5353
```yaml
5454
- name: Extend schema
5555
id: schema
56+
env:
57+
SCHEMA_PATH: ${{ steps.toolkit.outputs.schema_path }}
5658
run: |
57-
EXTENDED=$(echo "${{ steps.toolkit.outputs.schema_json }}" \
58-
| jq -c '.properties.missingQueryTimings = {"type":"boolean"} | .required += ["missingQueryTimings"]')
59+
EXTENDED=$(jq -c '.properties.missingQueryTimings = {"type":"boolean"} | .required += ["missingQueryTimings"]' "$SCHEMA_PATH")
5960
echo "json=$EXTENDED" >> "$GITHUB_OUTPUT"
6061
```
6162

6263
Keep extensions narrow - the canonical schema stays the source of truth for the violations array shared across all reviewers.
64+
65+
> [!WARNING]
66+
> Do **not** consume `schema_json` from a shell step via `echo "${{ steps.toolkit.outputs.schema_json }}"`. GitHub Actions interpolates the expression before bash parses the line, and the schema's inner `"` characters terminate the surrounding shell string - `jq` then sees mangled input and exits with a parse error. Use the `schema_path` form above for any `jq`/shell manipulation; reserve `schema_json` for the single-quoted `claude_args:` form shown in [Usage](#usage), where the action's argv parser handles it correctly.

0 commit comments

Comments
 (0)