mirror/mirror.sh
2024-11-18 11:28:00 +00:00

15 lines
401 B
Bash
Executable File

#!/bin/bash -e
mkdir -p "$HOME/.ssh"
echo "$INPUT_SSH_PRIV" > "$HOME/.ssh/id_ed25519"
echo "$INPUT_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts"
chmod 600 "$HOME/.ssh/id_ed25519"
URL="${GITHUB_SERVER_URL/\/\//\/\/$GITHUB_REPOSITORY_OWNER:$INPUT_TOKEN@}/$GITHUB_REPOSITORY"
git init -b main
git remote add origin "$URL"
git remote set-url --push origin "$INPUT_URL"
git fetch -pP
git push origin --mirror