From c25ab788f9479596189000839f9aecc2a0419ccd Mon Sep 17 00:00:00 2001 From: gold-silver-copper <157451540+gold-silver-copper@users.noreply.github.com> Date: Sun, 25 Oct 2026 16:27:52 -0700 Subject: [PATCH 1/3] ci: clone meta_core, which loop_lib now depends on Clones loop_lib and meta_core from the same branch when it exists, falling back to main. Implements [[tasks/harmony-2749]] --- .github/workflows/auto-format.yml | 16 ++++++++++++++-- .github/workflows/ci.yml | 14 ++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/auto-format.yml b/.github/workflows/auto-format.yml index c3a0c37..f1e7d1a 100644 --- a/.github/workflows/auto-format.yml +++ b/.github/workflows/auto-format.yml @@ -32,14 +32,26 @@ jobs: token: ${{ secrets.PARENT_REPO_PAT || github.token }} - name: Clone dependencies + shell: bash + env: + BRANCH: ${{ github.head_ref || github.ref_name }} run: | - git clone --depth 1 https://github.com/gitkb/loop_lib.git + for repo in loop_lib meta_core; do + if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then + echo "Cloned ${repo}@${BRANCH}" + elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then + echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch" + else + echo "::error::Failed to clone ${repo}" + exit 1 + fi + done - name: Create workspace Cargo.toml run: | cat > Cargo.toml << 'EOF' [workspace] - members = ["loop_cli", "loop_lib"] + members = ["loop_cli", "loop_lib", "meta_core"] resolver = "2" [workspace.package] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34633b1..9668a2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: env: BRANCH: ${{ github.head_ref || github.ref_name }} run: | - for repo in loop_lib; do + for repo in loop_lib meta_core; do if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then echo "Cloned ${repo}@${BRANCH}" elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then @@ -46,7 +46,7 @@ jobs: run: | cat > Cargo.toml << 'EOF' [workspace] - members = ["loop_cli", "loop_lib"] + members = ["loop_cli", "loop_lib", "meta_core"] resolver = "2" [workspace.package] @@ -78,10 +78,11 @@ jobs: path: loop_cli - name: Clone dependencies + shell: bash env: BRANCH: ${{ github.head_ref || github.ref_name }} run: | - for repo in loop_lib; do + for repo in loop_lib meta_core; do if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then echo "Cloned ${repo}@${BRANCH}" elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then @@ -96,7 +97,7 @@ jobs: run: | cat > Cargo.toml << 'EOF' [workspace] - members = ["loop_cli", "loop_lib"] + members = ["loop_cli", "loop_lib", "meta_core"] resolver = "2" [workspace.package] @@ -130,10 +131,11 @@ jobs: path: loop_cli - name: Clone dependencies + shell: bash env: BRANCH: ${{ github.head_ref || github.ref_name }} run: | - for repo in loop_lib; do + for repo in loop_lib meta_core; do if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then echo "Cloned ${repo}@${BRANCH}" elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then @@ -148,7 +150,7 @@ jobs: run: | cat > Cargo.toml << 'EOF' [workspace] - members = ["loop_cli", "loop_lib"] + members = ["loop_cli", "loop_lib", "meta_core"] resolver = "2" [workspace.package] From 7b5e6d74a3029822cc199e7feafbc1278373843f Mon Sep 17 00:00:00 2001 From: gold-silver-copper <157451540+gold-silver-copper@users.noreply.github.com> Date: Sun, 25 Oct 2026 16:27:52 -0700 Subject: [PATCH 2/3] ci: fall back to main only when the branch does not exist Implements [[tasks/harmony-2749]] --- .github/workflows/auto-format.yml | 15 +++++++---- .github/workflows/ci.yml | 45 ++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/.github/workflows/auto-format.yml b/.github/workflows/auto-format.yml index f1e7d1a..15b5f3d 100644 --- a/.github/workflows/auto-format.yml +++ b/.github/workflows/auto-format.yml @@ -37,12 +37,17 @@ jobs: BRANCH: ${{ github.head_ref || github.ref_name }} run: | for repo in loop_lib meta_core; do - if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then - echo "Cloned ${repo}@${BRANCH}" - elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then - echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch" + url="https://github.com/gitkb/${repo}.git" + # Exit code 2 means the branch does not exist; anything else is an error + status=0 + git ls-remote --exit-code --heads "$url" "$BRANCH" > /dev/null || status=$? + if [ "$status" -eq 0 ]; then + git clone --depth 1 -b "$BRANCH" "$url" + elif [ "$status" -eq 2 ]; then + echo "Branch ${BRANCH} not found for ${repo}; using the default branch" + git clone --depth 1 "$url" else - echo "::error::Failed to clone ${repo}" + echo "::error::Failed to look up ${repo}" exit 1 fi done diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9668a2a..7c973b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,12 +31,17 @@ jobs: BRANCH: ${{ github.head_ref || github.ref_name }} run: | for repo in loop_lib meta_core; do - if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then - echo "Cloned ${repo}@${BRANCH}" - elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then - echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch" + url="https://github.com/gitkb/${repo}.git" + # Exit code 2 means the branch does not exist; anything else is an error + status=0 + git ls-remote --exit-code --heads "$url" "$BRANCH" > /dev/null || status=$? + if [ "$status" -eq 0 ]; then + git clone --depth 1 -b "$BRANCH" "$url" + elif [ "$status" -eq 2 ]; then + echo "Branch ${BRANCH} not found for ${repo}; using the default branch" + git clone --depth 1 "$url" else - echo "::error::Failed to clone ${repo}" + echo "::error::Failed to look up ${repo}" exit 1 fi done @@ -83,12 +88,17 @@ jobs: BRANCH: ${{ github.head_ref || github.ref_name }} run: | for repo in loop_lib meta_core; do - if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then - echo "Cloned ${repo}@${BRANCH}" - elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then - echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch" + url="https://github.com/gitkb/${repo}.git" + # Exit code 2 means the branch does not exist; anything else is an error + status=0 + git ls-remote --exit-code --heads "$url" "$BRANCH" > /dev/null || status=$? + if [ "$status" -eq 0 ]; then + git clone --depth 1 -b "$BRANCH" "$url" + elif [ "$status" -eq 2 ]; then + echo "Branch ${BRANCH} not found for ${repo}; using the default branch" + git clone --depth 1 "$url" else - echo "::error::Failed to clone ${repo}" + echo "::error::Failed to look up ${repo}" exit 1 fi done @@ -136,12 +146,17 @@ jobs: BRANCH: ${{ github.head_ref || github.ref_name }} run: | for repo in loop_lib meta_core; do - if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then - echo "Cloned ${repo}@${BRANCH}" - elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then - echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch" + url="https://github.com/gitkb/${repo}.git" + # Exit code 2 means the branch does not exist; anything else is an error + status=0 + git ls-remote --exit-code --heads "$url" "$BRANCH" > /dev/null || status=$? + if [ "$status" -eq 0 ]; then + git clone --depth 1 -b "$BRANCH" "$url" + elif [ "$status" -eq 2 ]; then + echo "Branch ${BRANCH} not found for ${repo}; using the default branch" + git clone --depth 1 "$url" else - echo "::error::Failed to clone ${repo}" + echo "::error::Failed to look up ${repo}" exit 1 fi done From a730852577a85b83d6d3dcaace814bdd1a4e7e68 Mon Sep 17 00:00:00 2001 From: gold-silver-copper <157451540+gold-silver-copper@users.noreply.github.com> Date: Sun, 25 Oct 2026 16:27:52 -0700 Subject: [PATCH 3/3] ci: probe the exact branch ref, not one ending in the same name Implements [[tasks/harmony-2749]] --- .github/workflows/auto-format.yml | 2 +- .github/workflows/ci.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-format.yml b/.github/workflows/auto-format.yml index 15b5f3d..b7b4abd 100644 --- a/.github/workflows/auto-format.yml +++ b/.github/workflows/auto-format.yml @@ -40,7 +40,7 @@ jobs: url="https://github.com/gitkb/${repo}.git" # Exit code 2 means the branch does not exist; anything else is an error status=0 - git ls-remote --exit-code --heads "$url" "$BRANCH" > /dev/null || status=$? + git ls-remote --exit-code --heads "$url" "refs/heads/$BRANCH" > /dev/null || status=$? if [ "$status" -eq 0 ]; then git clone --depth 1 -b "$BRANCH" "$url" elif [ "$status" -eq 2 ]; then diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c973b5..58667f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: url="https://github.com/gitkb/${repo}.git" # Exit code 2 means the branch does not exist; anything else is an error status=0 - git ls-remote --exit-code --heads "$url" "$BRANCH" > /dev/null || status=$? + git ls-remote --exit-code --heads "$url" "refs/heads/$BRANCH" > /dev/null || status=$? if [ "$status" -eq 0 ]; then git clone --depth 1 -b "$BRANCH" "$url" elif [ "$status" -eq 2 ]; then @@ -91,7 +91,7 @@ jobs: url="https://github.com/gitkb/${repo}.git" # Exit code 2 means the branch does not exist; anything else is an error status=0 - git ls-remote --exit-code --heads "$url" "$BRANCH" > /dev/null || status=$? + git ls-remote --exit-code --heads "$url" "refs/heads/$BRANCH" > /dev/null || status=$? if [ "$status" -eq 0 ]; then git clone --depth 1 -b "$BRANCH" "$url" elif [ "$status" -eq 2 ]; then @@ -149,7 +149,7 @@ jobs: url="https://github.com/gitkb/${repo}.git" # Exit code 2 means the branch does not exist; anything else is an error status=0 - git ls-remote --exit-code --heads "$url" "$BRANCH" > /dev/null || status=$? + git ls-remote --exit-code --heads "$url" "refs/heads/$BRANCH" > /dev/null || status=$? if [ "$status" -eq 0 ]; then git clone --depth 1 -b "$BRANCH" "$url" elif [ "$status" -eq 2 ]; then