fix(phase4): init ComfyUI in place so a pre-seeded COMFY_DIR works

git clone refuses a non-empty target, so a COMFY_DIR pre-seeded with the
cached checkpoint (or converted .mlmodelc) would break setup. Replace clone
with git init + remote add + fetch + 'checkout -f', which populates the
ComfyUI tree without touching untracked files. Setup order is now free.
This commit is contained in:
aszc-dev
2026-05-25 15:49:07 +02:00
parent 60f2be86e6
commit 29b493454a
2 changed files with 18 additions and 5 deletions
+12 -5
View File
@@ -47,16 +47,23 @@ jobs:
run: |
set -euo pipefail
if [ -z "${COMFY_DIR:-}" ]; then echo "COMFY_DIR unset (see docs/ci-m2.md)"; exit 1; fi
# Init-in-place rather than `git clone`: COMFY_DIR may already hold the
# cached checkpoint (models/checkpoints) or converted .mlmodelc, and
# `git clone` refuses a non-empty target. init + fetch + `checkout -f`
# populates the ComfyUI tree while leaving untracked files (the
# checkpoint, the cached models) untouched — so setup order is free.
if [ ! -d "$COMFY_DIR/.git" ]; then
echo "cloning ComfyUI into $COMFY_DIR"
git clone https://github.com/comfyanonymous/ComfyUI.git "$COMFY_DIR"
echo "initialising ComfyUI repo in $COMFY_DIR"
mkdir -p "$COMFY_DIR"
git -C "$COMFY_DIR" init -q
fi
git -C "$COMFY_DIR" remote get-url origin >/dev/null 2>&1 \
|| git -C "$COMFY_DIR" remote add origin https://github.com/comfyanonymous/ComfyUI.git
git -C "$COMFY_DIR" fetch --quiet origin
if [ "$COMFY_MODE" = "latest" ]; then
git -C "$COMFY_DIR" checkout --quiet -B master origin/master
git -C "$COMFY_DIR" reset --hard --quiet origin/master
git -C "$COMFY_DIR" checkout -f -B master origin/master
else
git -C "$COMFY_DIR" checkout --quiet --force "$COMFY_REF"
git -C "$COMFY_DIR" checkout -f "$COMFY_REF"
fi
COMFY_SHA="$(git -C "$COMFY_DIR" rev-parse HEAD)"
echo "COMFY_SHA=$COMFY_SHA" >> "$GITHUB_ENV"
+6
View File
@@ -58,6 +58,12 @@ half of the matrix has to live on real hardware.
`Convert UNet variants if missing` step and cached across runs. Override
the filename with `CKPT_NAME` in the runner `.env` if needed.
Order is free: do this before or after the first run. The setup step
initialises the ComfyUI repo **in place** (`git init`, not `git clone`,
which would refuse a non-empty directory) and uses `checkout -f`, which
never removes untracked files — so a checkpoint you dropped in first is
preserved.
## Triggers
The Tier 2 workflow (`.github/workflows/tier2.yml`) runs: