From 220cc47ef9c2569ac0892ac19419d0f4010658c4 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 19:51:46 +0000 Subject: [PATCH] ci(frontend): Filter snapshot tests by changed files Co-Authored-By: Ryan Brooks --- .github/workflows/frontend-snapshots.yml | 26 +++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/frontend-snapshots.yml b/.github/workflows/frontend-snapshots.yml index cd10a797e83c..8bb252dd019d 100644 --- a/.github/workflows/frontend-snapshots.yml +++ b/.github/workflows/frontend-snapshots.yml @@ -15,11 +15,31 @@ env: NODE_OPTIONS: '--max-old-space-size=4096' SNAPSHOT_OUTPUT_DIR: .artifacts/snapshots jobs: + files-changed: + name: detect frontend changes + runs-on: ubuntu-24.04 + outputs: + frontend_all: ${{ steps.changes.outputs.frontend_all }} + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Check for frontend file changes + uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 + id: changes + with: + token: '' + filters: .github/file-filters.yml + snapshots: name: snapshot tests - # Skip 'edited' events that aren't a base branch change (e.g. title/body edits). - # When the base branch changes, the diff target changes so we need a fresh run. - if: github.event.action != 'edited' || github.event.changes.base != '' + needs: files-changed + # Always run for pushes to the base branch. For pull requests, run only when + # frontend files changed and skip edits that aren't a base branch change. + if: >- + always() && + (github.event_name == 'push' || + (needs.files-changed.outputs.frontend_all == 'true' && + (github.event.action != 'edited' || github.event.changes.base != ''))) runs-on: ubuntu-24.04 timeout-minutes: 20 steps: