From 128e6aeff180e9fe934001a21c89296fbfa8a24d Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 21 Jun 2026 03:02:37 -0700 Subject: [PATCH] pin CI helper repo clones --- .github/scripts/clone_abx_repo.sh | 27 +++++++++++++++++++++++++++ .github/workflows/lint.yml | 6 +++--- .github/workflows/test-parallel.yml | 14 +++++++------- .github/workflows/test.yml | 6 +++--- 4 files changed, 40 insertions(+), 13 deletions(-) create mode 100755 .github/scripts/clone_abx_repo.sh diff --git a/.github/scripts/clone_abx_repo.sh b/.github/scripts/clone_abx_repo.sh new file mode 100755 index 00000000..01908e03 --- /dev/null +++ b/.github/scripts/clone_abx_repo.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +repo_name="$1" +target_dir="${2:-$repo_name}" + +version="$( +python3 - "$repo_name" <<'PY' +import re +import sys +from pathlib import Path + +repo_name = sys.argv[1] +lock_text = Path("uv.lock").read_text() +match = re.search( + rf'^\[\[package\]\]\s*\nname = "{re.escape(repo_name)}"\s*\nversion = "([^"]+)"', + lock_text, + re.MULTILINE, +) +if not match: + raise SystemExit(f"Could not find {repo_name} in uv.lock") +print(match.group(1)) +PY +)" + +echo "Cloning ArchiveBox/${repo_name}@v${version} into ${target_dir}" +git clone --depth=1 --branch "v${version}" "https://github.com/ArchiveBox/${repo_name}.git" "$target_dir" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2bb365bb..f0682d00 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,13 +22,13 @@ jobs: fetch-depth: 1 - name: Clone abxpkg - run: git clone --depth=1 https://github.com/ArchiveBox/abxpkg.git abxpkg + run: bash .github/scripts/clone_abx_repo.sh abxpkg - name: Clone abx-plugins - run: git clone --depth=1 https://github.com/ArchiveBox/abx-plugins.git abx-plugins + run: bash .github/scripts/clone_abx_repo.sh abx-plugins - name: Clone abx-dl - run: git clone --depth=1 https://github.com/ArchiveBox/abx-dl.git abx-dl + run: bash .github/scripts/clone_abx_repo.sh abx-dl - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/test-parallel.yml b/.github/workflows/test-parallel.yml index 4ac4d084..dc58232b 100644 --- a/.github/workflows/test-parallel.yml +++ b/.github/workflows/test-parallel.yml @@ -67,7 +67,7 @@ jobs: echo "$json_array" | jq '.' - name: Clone abx-plugins - run: git clone --depth=1 https://github.com/ArchiveBox/abx-plugins.git abx-plugins + run: bash .github/scripts/clone_abx_repo.sh abx-plugins - name: Discover plugin tests id: set-plugin-matrix @@ -124,13 +124,13 @@ jobs: fetch-depth: 1 - name: Clone abxpkg - run: git clone --depth=1 https://github.com/ArchiveBox/abxpkg.git abxpkg + run: bash .github/scripts/clone_abx_repo.sh abxpkg - name: Clone abx-plugins - run: git clone --depth=1 https://github.com/ArchiveBox/abx-plugins.git abx-plugins + run: bash .github/scripts/clone_abx_repo.sh abx-plugins - name: Clone abx-dl - run: git clone --depth=1 https://github.com/ArchiveBox/abx-dl.git abx-dl + run: bash .github/scripts/clone_abx_repo.sh abx-dl - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v5 @@ -260,13 +260,13 @@ jobs: fetch-depth: 1 - name: Clone abxpkg - run: git clone --depth=1 https://github.com/ArchiveBox/abxpkg.git abxpkg + run: bash .github/scripts/clone_abx_repo.sh abxpkg - name: Clone abx-plugins - run: git clone --depth=1 https://github.com/ArchiveBox/abx-plugins.git abx-plugins + run: bash .github/scripts/clone_abx_repo.sh abx-plugins - name: Clone abx-dl - run: git clone --depth=1 https://github.com/ArchiveBox/abx-dl.git abx-dl + run: bash .github/scripts/clone_abx_repo.sh abx-dl - name: Set up Python 3.13 uses: actions/setup-python@v5 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b468b6c6..cce93d98 100755 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,13 +31,13 @@ jobs: fetch-depth: 1 - name: Clone abxpkg - run: git clone --depth=1 https://github.com/ArchiveBox/abxpkg.git abxpkg + run: bash .github/scripts/clone_abx_repo.sh abxpkg - name: Clone abx-plugins - run: git clone --depth=1 https://github.com/ArchiveBox/abx-plugins.git abx-plugins + run: bash .github/scripts/clone_abx_repo.sh abx-plugins - name: Clone abx-dl - run: git clone --depth=1 https://github.com/ArchiveBox/abx-dl.git abx-dl + run: bash .github/scripts/clone_abx_repo.sh abx-dl ### Setup Python & JS Languages - name: Set up Python ${{ matrix.python }}