: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(ci): compute impacted targets against master, not the stack parent (#86680)
posthog[bot]3e5be63c3035
diff --git a/.github/workflows/pr-housekeeping.yml b/.github/workflows/pr-housekeeping.ymlindex 6c7a03f8f529..d89d173c0c94 100644--- a/.github/workflows/pr-housekeeping.yml+++ b/.github/workflows/pr-housekeeping.yml@@ -11,8 +11,11 @@ on:# Keyed by event action so a new push (synchronize) cancels the previous# push's run without cancelling runs fired by other event types on the PR.+# A base retarget gets its own key within `edited`: it is the only edit that+# recomputes impacted targets, and a title edit landing behind it would+# otherwise cancel that recompute and leave the stale upload in place.concurrency:- group: pr-housekeeping-${{ github.event.action }}-${{ github.event.pull_request.number }}+ group: pr-housekeeping-${{ github.event.action }}${{ github.event.changes.base && '-base' || '' }}-${{ github.event.pull_request.number }}cancel-in-progress: true# Parent defaults stay read-only; jobs that need more request it explicitly.@@ -36,7 +39,14 @@ jobs:trunk-impacted-targets:# Also on ready_for_review: Trunk keys the upload to a head SHA, and a PR# can sit in draft long enough for the queue to have forgotten it.- if: contains(fromJSON('["opened", "synchronize", "reopened", "ready_for_review"]'), github.event.action)+ # Also on a base retarget, which GitHub does on the PR's behalf when the+ # layer below a stack merges. The targets are computed against the merge+ # target, so a retarget changes them with no push to recompute them on,+ # and the stale upload is what the queue keeps scheduling by. Other+ # `edited` actions (title, body) cannot move a target, so they are left out.+ if: >-+ contains(fromJSON('["opened", "synchronize", "reopened", "ready_for_review"]'), github.event.action)+ || (github.event.action == 'edited' && github.event.changes.base != null)uses: ./.github/workflows/trunk-impacted-targets.ymlpermissions:contents: readdiff --git a/.github/workflows/trunk-impacted-targets.yml b/.github/workflows/trunk-impacted-targets.ymlindex efca92819fc3..a405834d985b 100644--- a/.github/workflows/trunk-impacted-targets.yml+++ b/.github/workflows/trunk-impacted-targets.yml@@ -63,10 +63,17 @@ jobs:fetch-depth: 1000filter: blob:none- - name: Fetch PR base for the changed-file diff+ # The default branch, not `base.ref`. A stacked PR's base is the layer+ # below it, but the queue tests the whole stack merged into master, so+ # master is the radius Trunk schedules against. Diffing against a stack+ # parent that has fallen behind master counts every commit the head+ # picked up in between as this PR's own, and a change set that wide+ # claims every lane — which serializes the queue behind a PR that+ # touched none of them.+ - name: Fetch the merge target for the changed-file diffenv:- 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"+ MERGE_TARGET: ${{ github.event.repository.default_branch }}+ run: git fetch --no-tags --depth=1000 --filter=blob:none origin "$MERGE_TARGET:refs/remotes/origin/$MERGE_TARGET"- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:@@ -76,7 +83,7 @@ jobs:- name: Compute impacted targetsid: targetsenv:- BASE_REF: ${{ github.event.pull_request.base.ref }}+ MERGE_TARGET: ${{ github.event.repository.default_branch }}run: |set -uo pipefail@@ -84,8 +91,8 @@ jobs:# any diff failure has to widen to ALL rather than upload a# partial file list, which Trunk cannot distinguish from a# complete one.- if ! merge_base="$(git merge-base "refs/remotes/origin/$BASE_REF" HEAD 2>/dev/null)"; then- echo "::warning::No merge base against $BASE_REF within the fetched depth; reporting ALL."+ if ! merge_base="$(git merge-base "refs/remotes/origin/$MERGE_TARGET" HEAD 2>/dev/null)"; then+ echo "::warning::No merge base against $MERGE_TARGET within the fetched depth; reporting ALL."echo 'targets={"impactedTargets":"ALL"}' >> "$GITHUB_OUTPUT"exit 0fi