1
0

clone_repos.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # Clone every published Full Stack Skills package into a sibling workspace.
  3. set -euo pipefail
  4. script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  5. catalog_root="$(cd "$script_dir/.." && pwd)"
  6. workspace_root="$(cd "$catalog_root/.." && pwd)"
  7. target_dir="${FULL_STACK_SKILLS_REPOSITORIES_DIR:-$workspace_root/full-stack-skills-repositories}"
  8. repository_list="$script_dir/repositories.txt"
  9. organization="full-stack-skills"
  10. mkdir -p "$target_dir"
  11. while IFS= read -r repository; do
  12. if [[ -z "$repository" || "$repository" == \#* ]]; then
  13. continue
  14. fi
  15. destination="$target_dir/$repository"
  16. if [[ -d "$destination/.git" ]]; then
  17. echo "present $repository"
  18. continue
  19. fi
  20. if [[ -e "$destination" ]]; then
  21. echo "ERROR: $destination exists but is not a Git repository" >&2
  22. exit 1
  23. fi
  24. echo "clone $organization/$repository"
  25. git clone "https://github.com/$organization/$repository.git" "$destination"
  26. done < "$repository_list"
  27. echo "Repository inventory synchronized in $target_dir"