: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
chore(ci): skip frontend and e2e checks for bot snapshot-only commits (#64675)
Fernando Gomesf4b21a0cc87e
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.ymlindex 1a0eb12c8f6e..cea94ddbc3e8 100644--- a/.github/workflows/ci-e2e-playwright.yml+++ b/.github/workflows/ci-e2e-playwright.yml@@ -144,14 +144,51 @@ jobs:- docker-compose.dev.yml- Dockerfile+ # Visual Review auto-commits a snapshot baseline after human review and CI+ # approval. Re-running the ~25-min E2E stack for that bot push is pure waste;+ # the `playwright_tests` aggregator treats the resulting skip as success. Key+ # off the push delta (this push's commits), not the whole-PR diff dorny reports,+ # so it fires even when the PR also carries real code changes.+ - name: Detect Visual Review baseline-only push+ id: baseline_push+ if: github.event_name == 'pull_request' && github.event.action == 'synchronize'+ env:+ GH_TOKEN: ${{ github.token }}+ REPO: ${{ github.repository }}+ ACTOR: ${{ github.actor }}+ BEFORE: ${{ github.event.before }}+ AFTER: ${{ github.event.after }}+ run: |+ set -euo pipefail+ result=false+ # Visual Review commits the approved baseline as a bot (a [bot] app or posthog-bot).+ case "$ACTOR" in+ *'[bot]' | posthog-bot) is_bot=true ;;+ *) is_bot=false ;;+ esac+ zero=0000000000000000000000000000000000000000+ if [ "$is_bot" = true ] && [ -n "$BEFORE" ] && [ "$BEFORE" != "$zero" ] && [ -n "$AFTER" ]; then+ # compare uses merge-base(before, after), which for an appended commit is+ # exactly the push delta; a force-push/rebase widens it and won't match.+ files=$(gh api "repos/${REPO}/compare/${BEFORE}...${AFTER}" --jq '.files[].filename' || true)+ if [ -n "$files" ] && ! grep -qvE '^(frontend|playwright)/snapshots\.yml$' <<<"$files"; then+ result=true+ fi+ fi+ echo "result=$result" >>"$GITHUB_OUTPUT"+ echo "Visual Review baseline-only push: $result"+- name: Decide whether to run Playwrightid: decideenv:IS_PUSH: ${{ github.event_name == 'push' }}IS_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}SHOULD_RUN: ${{ steps.changes.outputs.shouldRun }}+ IS_BASELINE_ONLY: ${{ steps.baseline_push.outputs.result }}run: |- if [[ "$IS_PUSH" == "true" || "$IS_DISPATCH" == "true" || "$SHOULD_RUN" == "true" ]]; then+ if [[ "$IS_BASELINE_ONLY" == "true" ]]; then+ echo "shouldRun=false" >> "$GITHUB_OUTPUT"+ elif [[ "$IS_PUSH" == "true" || "$IS_DISPATCH" == "true" || "$SHOULD_RUN" == "true" ]]; thenecho "shouldRun=true" >> "$GITHUB_OUTPUT"elseecho "shouldRun=false" >> "$GITHUB_OUTPUT"diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.ymlindex adc7758a1d98..c08680565ca9 100644--- a/.github/workflows/ci-frontend.yml+++ b/.github/workflows/ci-frontend.yml@@ -30,13 +30,24 @@ jobs:runs-on: ubuntu-latesttimeout-minutes: 5name: Determine need to run frontend checks+ # Skip when a bot's push adds only snapshot baselines — Visual Review auto-commits+ # frontend/snapshots.yml after human review and CI approval, so re-running the suite+ # on that commit is pure waste. The detect step keys off the push delta (this push's+ # commits), not the whole-PR diff dorny reports, so it fires even when the PR also+ # carries real code changes. The aggregator (frontend_tests) treats skips as success.outputs:# AND the broad filter with `exclude` (below): a PR that touches only# the Node-only agent-platform services/packages must not trigger# frontend CI — they have their own suite (ci-agents.yml) and are# excluded from jest (frontend/jest.config.ts) and the bundle.- frontend: ${{ (steps.filter.outputs.frontend || 'true') == 'true' && (steps.exclude.outputs.outside_non_frontend_ts || 'true') == 'true' }}- frontend_code: ${{ (steps.filter.outputs.frontend_code || 'true') == 'true' && (steps.exclude.outputs.outside_non_frontend_ts || 'true') == 'true' }}+ frontend: >-+ ${{ (steps.filter.outputs.frontend || 'true') == 'true'+ && (steps.exclude.outputs.outside_non_frontend_ts || 'true') == 'true'+ && steps.baseline_push.outputs.result != 'true' }}+ frontend_code: >-+ ${{ (steps.filter.outputs.frontend_code || 'true') == 'true'+ && (steps.exclude.outputs.outside_non_frontend_ts || 'true') == 'true'+ && steps.baseline_push.outputs.result != 'true' }}steps:# For pull requests it's not necessary to check out the code, but we# also want this to run on master, so we need to check out@@ -112,6 +123,36 @@ jobs:- webpack.config.js- stylelint*+ - name: Detect Visual Review baseline-only push+ id: baseline_push+ if: github.event_name == 'pull_request' && github.event.action == 'synchronize'+ env:+ GH_TOKEN: ${{ github.token }}+ REPO: ${{ github.repository }}+ ACTOR: ${{ github.actor }}+ BEFORE: ${{ github.event.before }}+ AFTER: ${{ github.event.after }}+ run: |+ set -euo pipefail+ result=false+ # Visual Review commits the approved baseline as a bot (a [bot] app or posthog-bot).+ case "$ACTOR" in+ *'[bot]' | posthog-bot) is_bot=true ;;+ *) is_bot=false ;;+ esac+ zero=0000000000000000000000000000000000000000+ if [ "$is_bot" = true ] && [ -n "$BEFORE" ] && [ "$BEFORE" != "$zero" ] && [ -n "$AFTER" ]; then+ # Diff only the commits this push added. compare uses merge-base(before, after),+ # which for an appended commit is exactly the push delta; a force-push/rebase+ # widens it and won't match. dorny above already covers the whole-PR diff.+ files=$(gh api "repos/${REPO}/compare/${BEFORE}...${AFTER}" --jq '.files[].filename' || true)+ if [ -n "$files" ] && ! grep -qvE '^(frontend|playwright)/snapshots\.yml$' <<<"$files"; then+ result=true+ fi+ fi+ echo "result=$result" >>"$GITHUB_OUTPUT"+ echo "Visual Review baseline-only push: $result"+# Dirs that match the broad `frontend` rules above but aren't frontend# code — Node-only TS that has its own suite (ci-agents.yml) and isn't in# jest or the bundle. Appending a plain `!...` negation to the rules abovediff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.ymlindex e8417a459f8f..bc1e8b779a07 100644--- a/.github/workflows/ci-storybook.yml+++ b/.github/workflows/ci-storybook.yml@@ -34,9 +34,11 @@ jobs:# including backend files. Instead we use two positive filters and# compare counts to exclude generated-only PRs.#- # Additionally skip when a bot commits only frontend/snapshots.yml on- # a PR — that file is updated automatically after human review and CI- # approval, so re-running the full storybook suite is pure waste.+ # Additionally skip when a bot's push adds only snapshot baselines —+ # Visual Review auto-commits frontend/snapshots.yml after human review+ # and CI approval, so re-running the suite is pure waste. The detect+ # step keys off the push delta (this push's commits), not the whole-PR+ # diff dorny reports, so it fires even when the PR also has code changes.frontend: >-${{github.event_name == 'push'@@ -44,10 +46,7 @@ jobs:&& steps.exclude.outputs.outside_non_frontend_ts == 'true'&& fromJSON(steps.filter.outputs.frontend_count || '0')> fromJSON(steps.filter.outputs.frontend_generated_count || '0')- && !(github.event_name == 'pull_request'- && (contains(github.actor, '[bot]') || github.actor == 'posthog-bot')- && fromJSON(steps.filter.outputs.snapshots_count || '0')- == fromJSON(steps.filter.outputs.frontend_count || '0')))+ && steps.baseline_push.outputs.result != 'true')}}matrix: ${{ steps.matrix.outputs.matrix }}steps:@@ -80,8 +79,35 @@ jobs:frontend_generated:- 'frontend/src/generated/**'- 'products/**/frontend/generated/**'- snapshots:- - 'frontend/snapshots.yml'++ - name: Detect Visual Review baseline-only push+ id: baseline_push+ if: github.event_name == 'pull_request' && github.event.action == 'synchronize'+ env:+ GH_TOKEN: ${{ github.token }}+ REPO: ${{ github.repository }}+ ACTOR: ${{ github.actor }}+ BEFORE: ${{ github.event.before }}+ AFTER: ${{ github.event.after }}+ run: |+ set -euo pipefail+ result=false+ # Visual Review commits the approved baseline as a bot (a [bot] app or posthog-bot).+ case "$ACTOR" in+ *'[bot]' | posthog-bot) is_bot=true ;;+ *) is_bot=false ;;+ esac+ zero=0000000000000000000000000000000000000000+ if [ "$is_bot" = true ] && [ -n "$BEFORE" ] && [ "$BEFORE" != "$zero" ] && [ -n "$AFTER" ]; then+ # compare uses merge-base(before, after), which for an appended commit is+ # exactly the push delta; a force-push/rebase widens it and won't match.+ files=$(gh api "repos/${REPO}/compare/${BEFORE}...${AFTER}" --jq '.files[].filename' || true)+ if [ -n "$files" ] && ! grep -qvE '^(frontend|playwright)/snapshots\.yml$' <<<"$files"; then+ result=true+ fi+ fi+ echo "result=$result" >>"$GITHUB_OUTPUT"+ echo "Visual Review baseline-only push: $result"# The `frontend` filter's `products/**/*.{ts,tsx}` rule matches dirs that# aren't frontend code — Node-only TS (agent-platform services/packages)