Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): shallow checkout plus blobless history in selector jobs (#128436)

Georges-Antoine Assi1269c957711c
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.yml
index fc8293b63d07..75a94caca6f8 100644
--- a/.github/workflows/ci-e2e-playwright.yml
+++ b/.github/workflows/ci-e2e-playwright.yml
@@ -426,14 +426,12 @@ jobs:
full_run_reason_detail: ${{ steps.classify.outputs.full_run_reason_detail }}
steps:
# Full checkout at PR head so the selector can glob specs on disk and read
- # the map/script from the branch under test. Bounded depth + blob:none keeps
- # the merge-base with the base branch reachable cheaply.
+ # the map/script from the branch under test. The selector step fetches bounded,
+ # blobless history so the merge-base with the base branch stays reachable cheaply.
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- fetch-depth: 1000
- filter: blob:none
- name: Run spec selector
id: select
@@ -443,15 +441,17 @@ jobs:
continue-on-error: true
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
shell: bash
run: |
set -euo pipefail
- # Fetch the current tip of the base branch (scoped, blobless, no tags),
- # then diff origin/$BASE_REF...HEAD (3-dot = merge-base) so master
- # commits merged into the branch aren't counted as changes.
+ # Fetch the PR's history and the current tip of the base branch (scoped,
+ # blobless, no tags), then diff origin/$BASE_REF...HEAD (3-dot = merge-base)
+ # so master commits merged into the branch aren't counted as changes.
# This runs before Python, so tag a fetch failure with its own detail —
# otherwise classify sees only a failed step and reports an empty detail.
- if ! git fetch --no-tags --depth=1000 --filter=blob:none origin "$BASE_REF:refs/remotes/origin/$BASE_REF"; then
+ if ! git fetch --no-tags --depth=1000 --filter=blob:none origin "$HEAD_SHA" \
+ || ! git fetch --no-tags --depth=1000 --filter=blob:none origin "$BASE_REF:refs/remotes/origin/$BASE_REF"; then
echo "::warning::git fetch of base ref failed — full run"
echo "reason_detail=git_fetch_failed" >> "$GITHUB_OUTPUT"
exit 1
diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.yml
index 4f1c1bea2a34..f9a24b6719a0 100644
--- a/.github/workflows/ci-frontend.yml
+++ b/.github/workflows/ci-frontend.yml
@@ -305,9 +305,6 @@ jobs:
full_run_reason_detail: ${{ steps.classify.outputs.full_run_reason_detail }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- fetch-depth: 1000
- filter: blob:none
- name: Compute changed files
id: diff
@@ -316,6 +313,7 @@ jobs:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
set -euo pipefail
+ git fetch --no-tags --depth=1000 --filter=blob:none origin "$GITHUB_SHA"
git fetch --no-tags --depth=1000 --filter=blob:none origin "$BASE_REF:refs/remotes/origin/$BASE_REF"
# `...` resolves against the merge-base so files merged in from base
# don't inflate the diff (mirrors find-affected-stories / snob).
diff --git a/.github/workflows/ci-mcp.yml b/.github/workflows/ci-mcp.yml
index 8a21a4979224..5ce77e57b6dc 100644
--- a/.github/workflows/ci-mcp.yml
+++ b/.github/workflows/ci-mcp.yml
@@ -395,10 +395,6 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- # PR schema keys need merge-base history; scheduled keys use only HEAD.
- fetch-depth: ${{ github.event_name == 'schedule' && 1 || 1000 }}
- filter: blob:none
- name: Clean up data directories with container permissions
run: |
@@ -519,11 +515,13 @@ jobs:
COMPOSE_PROFILES: temporal
run: bin/ci-wait-for-docker wait temporal
- - name: Fetch current PR base for merge-base
+ - name: Fetch PR history and current base for merge-base
if: github.event_name == 'pull_request'
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
- run: git fetch --no-tags --depth=1000 --filter=blob:none origin "$BASE_REF:refs/remotes/origin/$BASE_REF"
+ run: |
+ git fetch --no-tags --depth=1000 --filter=blob:none origin "$GITHUB_SHA"
+ git fetch --no-tags --depth=1000 --filter=blob:none origin "$BASE_REF:refs/remotes/origin/$BASE_REF"
- name: Compute schema cache key
id: schema-key
@@ -532,7 +530,7 @@ jobs:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
# HEAD is the synthetic merge commit; HEAD^2 is the PR branch tip.
- # The fetch-depth:1000 checkout + base-ref fetch above ensure the
+ # The history fetch + base-ref fetch above ensure the
# full ancestry needed to find the divergence point is available.
if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then
# Only restore an exact migration/routing match on the hourly lane.