Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

ci: use shallow checkout for forced installer smokes (#824)

Danny Ward7951e02bda5b
diff --git a/.github/workflows/installer-smoke.yml b/.github/workflows/installer-smoke.yml
index 7b3b77906e..ac5584a811 100644
--- a/.github/workflows/installer-smoke.yml
+++ b/.github/workflows/installer-smoke.yml
@@ -72,10 +72,10 @@ jobs:
run-fresh: ${{ steps.paths.outputs.run-fresh }}
run-verify: ${{ steps.paths.outputs.run-verify }}
steps:
- - name: Checkout (full history — the path gate needs a diff base)
+ - name: Checkout (shallow; path-gated runs fetch a diff base if needed)
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
- fetch-depth: 0
+ fetch-depth: 1
persist-credentials: false
- name: Pick OS matrix
@@ -110,10 +110,16 @@ jobs:
""|*[!0]*) : ;;
*) base="" ;;
esac
+ if [ -n "$base" ] && ! git cat-file -e "$base^{commit}" 2>/dev/null; then
+ # A one-commit checkout does not contain github.event.before (or a
+ # pull request's base SHA). Fetch that exact tree so direct pushes
+ # on main are diffed against the event's actual prior commit.
+ git fetch --no-tags --depth=1 origin "$base" 2>/dev/null || true
+ fi
if [ -z "$base" ] || ! git cat-file -e "$base^{commit}" 2>/dev/null; then
- # checkout fetches the event's ref only, so origin/main may not exist
- # locally yet — same fetch ci.yml's privacy-gate job does.
- git fetch --no-tags origin main:refs/remotes/origin/main 2>/dev/null || true
+ # Manual non-forced runs may not have an event base; try main, then
+ # fail open below if no usable diff base is available.
+ git fetch --no-tags --depth=1 origin main:refs/remotes/origin/main 2>/dev/null || true
base="$(git merge-base HEAD refs/remotes/origin/main 2>/dev/null || echo "")"
fi
if [ -z "$base" ]; then
@@ -351,4 +357,4 @@ jobs:
uses: ./.github/workflows/release-wrapper-smoke.yml
with:
tag: ${{ inputs.tag }}
- platforms: '["ubuntu-latest"]'
\ No newline at end of file
+ platforms: '["ubuntu-latest"]'
diff --git a/tests/unit/ci/test_installer_smoke_fetch_depth.py b/tests/unit/ci/test_installer_smoke_fetch_depth.py
new file mode 100644
index 0000000000..60a0a08621
--- /dev/null
+++ b/tests/unit/ci/test_installer_smoke_fetch_depth.py
@@ -0,0 +1,24 @@
+from pathlib import Path
+
+import yaml
+
+ROOT = Path(__file__).resolve().parents[3]
+WORKFLOW = ROOT / ".github" / "workflows" / "installer-smoke.yml"
+
+
+def test_forced_installer_smoke_avoids_full_history_checkout() -> None:
+ workflow = yaml.safe_load(WORKFLOW.read_text(encoding="utf-8"))
+ steps = workflow["jobs"]["changes"]["steps"]
+
+ checkout = next(step for step in steps if step.get("name", "").startswith("Checkout"))
+ assert checkout["with"]["fetch-depth"] == 1
+
+ path_gate = next(step for step in steps if step.get("id") == "paths")
+ script = path_gate["run"]
+ force_short_circuit = script.index('if [ "${{ inputs.force }}" = "true" ]; then')
+ event_base_fetch = script.index('git fetch --no-tags --depth=1 origin "$base"')
+ main_fetch = script.index("git fetch --no-tags --depth=1 origin main:refs/remotes/origin/main")
+
+ assert force_short_circuit < event_base_fetch < main_fetch
+ assert "exit 0" in script[force_short_circuit:event_base_fetch]
+ assert 'github.event.before' in script