mirror/entrypoint.sh

14 lines
440 B
Bash
Raw Permalink Normal View History

2024-11-18 10:26:37 +00:00
#!/bin/bash -e
mkdir -p "$HOME/.ssh"
echo "$INPUT_SSH_PRIV" > "$HOME/.ssh/id_ed25519"
echo "$INPUT_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts"
2024-11-18 10:44:56 +00:00
chmod 600 "$HOME/.ssh/id_ed25519"
2024-11-18 10:26:37 +00:00
2024-11-18 11:16:45 +00:00
URL="${GITHUB_SERVER_URL/\/\//\/\/$GITHUB_REPOSITORY_OWNER:$INPUT_TOKEN@}/$GITHUB_REPOSITORY"
2024-11-18 16:29:04 +00:00
git init -b main
2024-11-18 11:16:45 +00:00
git remote add origin "$URL"
2024-11-18 16:00:59 +00:00
git fetch --no-tags --prune --no-recurse-submodules origin "$GITHUB_SHA"
2024-11-18 16:42:02 +00:00
git push -f "$INPUT_URL" "$GITHUB_SHA:$GITHUB_REF"