Files
skillshare/.devcontainer/start-dev.sh
T
Willie 084d93bf94 feat(devcontainer): add credential-helper toggle and token forwarding
Add tooling for testing private repo auth inside the devcontainer:

- credential-helper script (on/off/status) with --eval mode to
  toggle both git credential helper and token env vars in one command
- remoteEnv forwards host token env vars (GITHUB_TOKEN, GITLAB_TOKEN,
  BITBUCKET_TOKEN, BITBUCKET_USERNAME, SKILLSHARE_GIT_TOKEN)
- docker-compose env_file for .devcontainer/.env (optional, gitignored)
- start-dev.sh auto-detects GITHUB_TOKEN from gh CLI on container start
- .env.example template for all supported tokens
- docker-sandbox.md documents token sources and private repo testing
2026-02-21 06:07:35 +08:00

22 lines
767 B
Bash
Executable File

#!/usr/bin/env bash
# Resolve GITHUB_TOKEN and print available commands on container start.
set -euo pipefail
# Auto-detect GITHUB_TOKEN from gh CLI if not already set
# (via .env, remoteEnv, or manual export).
if [ -z "${GITHUB_TOKEN:-}" ] && command -v gh &>/dev/null; then
token="$(gh auth token 2>/dev/null || true)"
if [ -n "$token" ]; then
export GITHUB_TOKEN="$token"
echo "GITHUB_TOKEN auto-detected from gh CLI"
fi
fi
echo "Dev servers ready:"
echo " ui # global-mode dashboard → :5173"
echo " ui -p # project-mode dashboard → :5173"
echo " ui stop # stop dashboard"
echo " docs # documentation site → :3000"
echo " docs stop # stop docs"
echo " ss ... # instant mode (go run, no manual rebuild)"