Skip to content

Instantly share code, notes, and snippets.

@krzkaczor
Created February 22, 2026 20:33
Show Gist options
  • Select an option

  • Save krzkaczor/965d7f54302f22656404e689e4faa55a to your computer and use it in GitHub Desktop.

Select an option

Save krzkaczor/965d7f54302f22656404e689e4faa55a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Setup script to copy .env files from the root repository to this workspace
# Uses Conductor-provided environment variables
set -e
# Validate required environment variables
if [ -z "$CONDUCTOR_ROOT_PATH" ]; then
echo "Error: CONDUCTOR_ROOT_PATH is not set"
exit 1
fi
if [ -z "$CONDUCTOR_WORKSPACE_PATH" ]; then
echo "Error: CONDUCTOR_WORKSPACE_PATH is not set"
exit 1
fi
echo "Copying .env files from $CONDUCTOR_ROOT_PATH to $CONDUCTOR_WORKSPACE_PATH"
# Find all files named exactly .env (not .env.example, .env.local, etc.)
# and copy them to the workspace preserving directory structure
cd "$CONDUCTOR_ROOT_PATH"
find . -name ".env" -type f | while read -r file; do
# Get the relative directory path
dir=$(dirname "$file")
# Create the target directory if it doesn't exist
mkdir -p "$CONDUCTOR_WORKSPACE_PATH/$dir"
# Copy the file
cp "$file" "$CONDUCTOR_WORKSPACE_PATH/$file"
echo "Copied: $file"
done
# Copy .vscode directory if it exists
if [ -d "$CONDUCTOR_ROOT_PATH/.vscode" ]; then
mkdir -p "$CONDUCTOR_WORKSPACE_PATH/.vscode"
cp -r "$CONDUCTOR_ROOT_PATH/.vscode/." "$CONDUCTOR_WORKSPACE_PATH/.vscode/"
echo "Copied: .vscode directory"
fi
echo "Done copying .env files and .vscode directory"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment