@@ -84,6 +84,9 @@ async def initialize(self, context: RunnerContext):
8484 """Initialize the adapter with context."""
8585 self .context = context
8686 logger .info (f"Initialized Claude Code adapter for session { context .session_id } " )
87+
88+ # Copy Google OAuth credentials from mounted Secret to writable workspace location
89+ await self ._setup_google_credentials ()
8790
8891 # Prepare workspace from input repo if provided
8992 async for event in self ._prepare_workspace ():
@@ -1456,3 +1459,25 @@ def _build_workspace_context_prompt(self, repos_cfg, workflow_name, artifacts_pa
14561459
14571460 return prompt
14581461
1462+
1463+ async def _setup_google_credentials (self ):
1464+ """Copy Google OAuth credentials from mounted Secret to writable workspace location."""
1465+ # Check if Google OAuth secret is mounted
1466+ secret_path = Path ("/app/.google_workspace_mcp/credentials/credentials.json" )
1467+ if not secret_path .exists ():
1468+ logging .debug ("Google OAuth credentials not found at %s, skipping setup" , secret_path )
1469+ return
1470+
1471+ # Create writable credentials directory in workspace
1472+ workspace_creds_dir = Path ("/workspace/.google_workspace_mcp/credentials" )
1473+ workspace_creds_dir .mkdir (parents = True , exist_ok = True )
1474+
1475+ # Copy credentials from read-only Secret mount to writable workspace
1476+ dest_path = workspace_creds_dir / "credentials.json"
1477+ try :
1478+ shutil .copy2 (secret_path , dest_path )
1479+ # Make it writable so workspace-mcp can update tokens
1480+ dest_path .chmod (0o644 )
1481+ logging .info ("✓ Copied Google OAuth credentials from Secret to writable workspace at %s" , dest_path )
1482+ except Exception as e :
1483+ logging .error ("Failed to copy Google OAuth credentials: %s" , e )
0 commit comments