Skip to content

fix(i18n): resolve Claude Code sandbox path issues in workflow#30710

Merged
crazywoola merged 3 commits intomainfrom
fix/i18n-workflow-sandbox-paths-20260107-215532
Jan 8, 2026
Merged

fix(i18n): resolve Claude Code sandbox path issues in workflow#30710
crazywoola merged 3 commits intomainfrom
fix/i18n-workflow-sandbox-paths-20260107-215532

Conversation

@lyzno1
Copy link
Member

@lyzno1 lyzno1 commented Jan 7, 2026

Summary

Follow-up fix for #30692. Resolves issues discovered during workflow execution when Claude Code sandbox working directory may vary.

Issues Fixed

1. Command Substitution Not Supported

Problem: git checkout -b "chore/i18n-sync-$(date +%Y%m%d-%H%M%S)" fails because Claude Code's Bash tool doesn't support $() command substitution.

Fix: Split into two separate commands:

# First, get timestamp date +%Y%m%d-%H%M%S # → 20260115-143052 # Then create branch using the output git -C ${{ github.workspace }} checkout -b chore/i18n-sync-20260115-143052

2. Working Directory Path Resolution

Problem: Claude Code sandbox working directory may vary (could be repo root or web/ subdirectory). Relative paths like git add web/i18n/ or pnpm --dir web may fail depending on the actual working directory.

Fix: Use absolute paths for ALL commands to ensure reliability regardless of working directory:

  • pnpm --dir ${{ github.workspace }}/web <command>
  • git -C ${{ github.workspace }} <command>
  • gh --repo ${{ github.repository }} <command>
  • File paths: ${{ github.workspace }}/web/i18n/...

3. Missing Tool Permission

Problem: date command needed for timestamp but not in allowedTools.

Fix: Added Bash(date *),Bash(date:*) to allowedTools.

Changes

Category Before After
pnpm commands pnpm --dir web install pnpm --dir ${{ github.workspace }}/web install
git commands git add web/i18n/ git -C ${{ github.workspace }} add web/i18n/
gh commands gh pr create gh pr create --repo ${{ github.repository }}
File paths web/i18n-config/languages.ts ${{ github.workspace }}/web/i18n-config/languages.ts
Branch creation $(date +%Y%m%d) substitution Two separate commands
allowedTools 10 patterns 12 patterns (+date)

Best Practices Applied

  1. Always use absolute paths - Claude Code sandbox working directory is not guaranteed
  2. Never use command substitution - $() is not supported in Claude Code's Bash tool
  3. Run commands one by one - Don't combine with && or ||
  4. Document clearly - Added "WORKING DIRECTORY & ABSOLUTE PATHS" section in prompt

Test Plan

  • Trigger workflow manually with workflow_dispatch
  • Verify pnpm commands work with absolute paths
  • Verify git commands use correct absolute paths
  • Verify branch creation works with two-step approach
  • Verify PR creation succeeds

🤖 Generated with Claude Code

Fixes issues discovered during workflow execution: 1. Command substitution `$()` not supported - split branch creation into two separate commands (get timestamp, then checkout) 2. Working directory issue - Claude Code sandbox runs from `web/` directory, causing path resolution failures: - Changed `pnpm --dir web` to just `pnpm` (already in web/) - Added `-C ${{ github.workspace }}` to all git commands - Added `--repo` flag to gh pr create command 3. Added documentation for working directory best practices 4. Added `date` command to allowedTools for timestamp generation Closes #30691
Copilot AI review requested due to automatic review settings January 7, 2026 13:56
@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resolves Claude Code sandbox execution issues in the i18n translation workflow by addressing command substitution limitations, working directory path resolution, and missing tool permissions.

Key Changes:

  • Replaced command substitution $(date +%Y%m%d-%H%M%S) with a two-step manual approach to accommodate Claude Code's Bash tool limitations
  • Updated all git and pnpm commands to account for the sandbox running from web/ directory
  • Added date tool permissions and comprehensive documentation about working directory context

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

lyzno1 added 2 commits January 7, 2026 22:01
Ensure reliability regardless of Claude Code sandbox working directory: - pnpm: `pnpm --dir ${{ github.workspace }}/web <cmd>` - git: `git -C ${{ github.workspace }} <cmd>` - gh: `gh --repo ${{ github.repository }} <cmd>` - File paths: `${{ github.workspace }}/web/i18n/...` Updated documentation section to clearly explain absolute path requirements.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 8, 2026
@crazywoola crazywoola merged commit 25ff4ae into main Jan 8, 2026
17 checks passed
@crazywoola crazywoola deleted the fix/i18n-workflow-sandbox-paths-20260107-215532 branch January 8, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

3 participants