Last active
May 10, 2024 06:20
-
-
Save orhun/eb8488d6658029ecdf843089bde0f29e to your computer and use it in GitHub Desktop.
Set up `softserve` to mirror repositories from GitHub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.6" | |
services: | |
soft-serve: | |
image: charmcli/soft-serve:latest | |
container_name: soft-serve | |
restart: unless-stopped | |
ports: | |
- 23231:23231 | |
- 23232:23232 | |
- 23233:23233 | |
- 9418:9418 | |
volumes: | |
- ./data:/soft-serve | |
env_file: | |
- ./.env # SOFT_SERVE_INITIAL_ADMIN_KEYS="ssh-ed25519 AA..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Define a `soft` entry in ~/.ssh/config as follows: | |
# | |
# ``` | |
# Host soft | |
# HostName localhost | |
# Port 23231 | |
# IdentityFile ~/.ssh/id_ed25519 | |
# ``` | |
repos=( | |
"https://github.com/orhun/dotfiles" | |
"https://github.com/orhun/daktilo" | |
) | |
# github_token="" | |
for repo in "${repos[@]}"; do | |
response=$( | |
curl -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${github_token}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"https://api.github.com/repos/${repo#https://github.com/}" | |
) | |
name=$(jq .name <<<"${response}") | |
description=$(jq .description <<<"${response}") | |
ssh soft repo import --mirror "${name}" --description "${description}" "${repo}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment