Restore project-atlas submodule metadata

This commit is contained in:
defiQUG
2026-07-30 13:12:41 -07:00
parent c25e4891be
commit 35e10d4b46
3 changed files with 31 additions and 0 deletions
+4
View File
@@ -1,3 +1,7 @@
[submodule "marketplace/as4-411"]
path = marketplace/as4-411
url = https://gitea.d-bis.org/d-bis/as4-411.git
[submodule "portal/src/data/project-atlas"]
path = portal/src/data/project-atlas
url = [email protected]:Sankofa_Phoenix/projectAtlas.git
branch = main
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(git rev-parse --show-toplevel)"
submodule_path="${PROJECT_ATLAS_SUBMODULE_PATH:-portal/src/data/project-atlas}"
ssh_key="${PROJECT_ATLAS_SSH_PRIVATE_KEY:-}"
key_file="${RUNNER_TEMP:-/tmp}/project-atlas-submodule-key"
# The Project Atlas submodule lives in Gitea and must be fetched with a
# read-only deploy key stored in PROJECT_ATLAS_SSH_PRIVATE_KEY.
if git -C "$repo_root" submodule status -- "$submodule_path" | grep -q '^-'; then
if [[ -z "$ssh_key" ]]; then
echo "PROJECT_ATLAS_SSH_PRIVATE_KEY is required to initialize the private projectAtlas submodule." >&2
exit 1
fi
install -d -m 700 "$HOME/.ssh"
printf '%s\n' "$ssh_key" > "$key_file"
chmod 600 "$key_file"
ssh-keyscan -H gitea.d-bis.org >> "$HOME/.ssh/known_hosts"
git -C "$repo_root" submodule sync -- "$submodule_path"
GIT_SSH_COMMAND="ssh -i $key_file -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes" \
git -C "$repo_root" submodule update --init --recursive -- "$submodule_path"
fi