Skip to content
Merged
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
5 changes: 3 additions & 2 deletions .claude/commands/review-translations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Review translation imports for quality issues (runs after sanitizer)
allowed-tools: Bash, Read, Glob, Grep, Task, AskUserQuestion
argument-hint: [--pr=NUMBER (auto)] [--scope=pr|full (pr)] [--language=CODE] [--model=opus|sonnet|haiku (opus)]
allowed-tools: Bash, Read, Glob, Grep, Task, Edit, AskUserQuestion
argument-hint: [--pr=NUMBER (auto)] [--scope=pr|full (pr)] [--language=CODE] [--model=opus|sonnet|haiku (opus)] [--fix]
---

# Translation Review Command
Expand Down Expand Up @@ -44,6 +44,7 @@ Reviews all files for a language when no PR context is available.
| `--scope=pr\|full` | `pr` = only PR changed files, `full` = all files for languages | `pr` |
| `--language=CODES` | Filter to specific language(s), comma-separated | all languages in PR |
| `--model=MODEL` | Model for analysis: `opus` (deep), `sonnet` (balanced), `haiku` (fast) | `opus` |
| `--fix` | Automatically apply fixes for critical issues after review | disabled |

## Phase 0: Determine Mode and Scope

Expand Down
51 changes: 35 additions & 16 deletions .github/workflows/claude-review-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ on:
- opus
- sonnet
- haiku
fix:
description: "Automatically fix critical translation issues"
required: false
default: false
type: boolean
issue_comment:
types: [created]
pull_request_review_comment:
Expand Down Expand Up @@ -95,6 +100,7 @@ jobs:
echo "language_flag=" >> $GITHUB_OUTPUT
echo "scope_flag=" >> $GITHUB_OUTPUT
echo "model=opus" >> $GITHUB_OUTPUT
echo "fix_flag=" >> $GITHUB_OUTPUT
exit 0
fi

Expand All @@ -108,6 +114,12 @@ jobs:
fi
echo "scope_flag=--scope=${{ github.event.inputs.scope }}" >> $GITHUB_OUTPUT
echo "model=${{ github.event.inputs.model }}" >> $GITHUB_OUTPUT
# Set fix_flag based on checkbox input
if [[ "${{ github.event.inputs.fix }}" == "true" ]]; then
echo "fix_flag=--fix" >> $GITHUB_OUTPUT
else
echo "fix_flag=" >> $GITHUB_OUTPUT
fi
exit 0
fi

Expand All @@ -134,6 +146,13 @@ jobs:
echo "model=opus" >> $GITHUB_OUTPUT
fi

# Extract --fix flag if present
if [[ "$COMMENT_BODY" =~ --fix ]]; then
echo "fix_flag=--fix" >> $GITHUB_OUTPUT
else
echo "fix_flag=" >> $GITHUB_OUTPUT
fi

- name: Post acknowledgment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -145,31 +164,31 @@ jobs:

- name: Run Claude Translation Review
uses: anthropics/claude-code-action@v1
timeout-minutes: 120
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
timeout_minutes: "120"
claude_args: "--model ${{ steps.parse.outputs.model }}"
# Enable Task tool for parallel language review agents (read-only + comment posting)
allowed_tools: "Task,Glob,Grep,LS,Read,Bash(git status:*),Bash(git diff:*),Bash(git log:*),Bash(git fetch:*),Bash(git worktree:*),Bash(gh api:*),Bash(gh pr view:*),Bash(gh pr comment:*)"
claude_args: |
--model ${{ steps.parse.outputs.model }}
--allowedTools "Task,Glob,Grep,LS,Read,Edit,WebFetch,Bash(git status:*),Bash(git diff:*),Bash(git log:*),Bash(git fetch:*),Bash(git worktree:*),Bash(git add:*),Bash(git commit:*),Bash(gh api:*),Bash(gh pr view:*),Bash(gh pr comment:*)"
prompt: |
Execute the /review-translations command for PR #${{ steps.pr.outputs.number }}.

Arguments: --pr=${{ steps.pr.outputs.number }} ${{ steps.parse.outputs.language_flag }} ${{ steps.parse.outputs.scope_flag }}
Arguments: --pr=${{ steps.pr.outputs.number }} ${{ steps.parse.outputs.language_flag }} ${{ steps.parse.outputs.scope_flag }} ${{ steps.parse.outputs.fix_flag }}

Follow the instructions in .claude/commands/review-translations.md for Phase 0 (scope detection), Phase 1 (parallel agents), and Phase 2 (collecting results).

IMPORTANT workflow modifications for GitHub Actions context:
1. Use parallel Task agents (ONE agent per language) as specified in the skill
2. SKIP Phase 3 entirely (no AskUserQuestion, no interactive prompts) - this is an automated workflow
3. After collecting results in Phase 2, post the full review report as a PR comment using:
2. After collecting results in Phase 2, post the full review report as a PR comment using:
gh pr comment ${{ steps.pr.outputs.number }} --body "..."
Use a HEREDOC for the body to preserve formatting.
4. Do NOT apply fixes automatically - just report the issues found
5. Do NOT prompt for user input - this is fully automated
6. If the report is very long (>60000 chars), split it into multiple comments per language
7. At the end of your review comment, if there are critical issues, include this section:
---
**To apply fixes**, reply with:
```
@claude Fix the critical brand name translation issues listed above
```
3. If the report is very long (>60000 chars), split it into multiple comments per language
4. Auto-fix behavior - check if --fix flag is present in Arguments above:
- If --fix flag IS present: After posting the review, automatically apply fixes for all critical issues found using the Edit tool (work in PR branch worktree as specified in skill). Then commit the changes.
- If --fix flag is NOT present: Do NOT apply fixes automatically - just report the issues found. At the end of your review comment, if there are critical issues, include:
---
**To apply fixes**, reply with:
```
@claude /review-translations --fix
```
5. Do NOT prompt for user input with AskUserQuestion - this is fully automated
Loading