CI: fix Fetch sources (remove broken heredoc; clean token-aware git clone)
Some checks failed
Build & Release Pack / build (push) Failing after 4s

This commit is contained in:
mithral 2026-08-26 14:11:23 -04:00
parent 8c9fda9f8a
commit 87b453c352

View file

@ -19,30 +19,13 @@ jobs:
- name: Fetch sources - name: Fetch sources
run: | run: |
if command -v git >/dev/null 2>&1; then REPO="https://git.mithraic.cloud/ad3laid3/FKRPG.git"
echo "git present -> cloning" if [ -n "${GITHUB_TOKEN}" ]; then
git clone --branch "${GITHUB_REF_NAME}" --depth 1 "https://x-access-token:${GITHUB_TOKEN}@git.mithraic.cloud/ad3laid3/FKRPG.git" "${GITHUB_WORKSPACE}" git -c "credential.https://git.mithraic.cloud.username=x-access-token" \
-c "credential.https://git.mithraic.cloud.password=${GITHUB_TOKEN}" \
clone --branch "${GITHUB_REF_NAME}" --depth 1 "${REPO}" "${GITHUB_WORKSPACE}"
else else
echo "git missing -> downloading archive via API" git clone --branch "${GITHUB_REF_NAME}" --depth 1 "${REPO}" "${GITHUB_WORKSPACE}"
python3 - <<'PY'
import urllib.request, tarfile, io, os, shutil
ws = os.environ.get('GITHUB_WORKSPACE') or os.getcwd()
sha = os.environ['GITHUB_SHA']
token = os.environ.get('GITHUB_TOKEN', '')
url = f"https://git.mithraic.cloud/api/v1/repos/ad3laid3/FKRPG/archive/{sha}.tar.gz"
req = urllib.request.Request(url, headers={"Authorization": f"token {token}"})
raw = urllib.request.urlopen(req, timeout=120).read()
os.makedirs('/tmp/fkrpg_src', exist_ok=True)
with tarfile.open(fileobj=io.BytesIO(raw)) as tf:
tf.extractall('/tmp/fkrpg_src')
src = os.path.join('/tmp/fkrpg_src', os.listdir('/tmp/fkrpg_src')[0])
for name in os.listdir(src):
dst = os.path.join(ws, name)
if os.path.exists(dst):
shutil.rmtree(dst) if os.path.isdir(dst) else os.remove(dst)
shutil.move(os.path.join(src, name), dst)
print("Extracted sources into", ws)
PY
fi fi
- name: Refresh index - name: Refresh index