From 3179ab1251e89a4a3a0da9578ffd5a37ef62b3c8 Mon Sep 17 00:00:00 2001
From: lbrdnk <lbrdnk@users.noreply.github.com>
Date: Mon, 29 Jan 2024 22:22:24 +0100
Subject: [PATCH] Add path filtering for cljs workflow (#38198)

* Add path filtering for cljs workflow

* Add shadow-cljs.edn to cljs file paths
---
 .github/file-paths.yaml    |  6 ++++++
 .github/workflows/cljs.yml | 16 ++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/.github/file-paths.yaml b/.github/file-paths.yaml
index d88ab4665ca..f1a2e0a2ad5 100644
--- a/.github/file-paths.yaml
+++ b/.github/file-paths.yaml
@@ -130,3 +130,9 @@ visualizations:
   - "frontend/src/metabase/visualizations/**"
   - "frontend/src/metabase/static-viz/**"
   - "src/metabase/pulse/**"
+
+cljs:
+  - *shared_sources
+  - *shared_specs
+  - ".github/workflows/cljs.yml"
+  - "shadow-cljs.edn"
diff --git a/.github/workflows/cljs.yml b/.github/workflows/cljs.yml
index 388d728fc61..2ce57460a4e 100644
--- a/.github/workflows/cljs.yml
+++ b/.github/workflows/cljs.yml
@@ -12,8 +12,24 @@ concurrency:
   cancel-in-progress: true
 
 jobs:
+  files-changed:
+    name: Check which files changed
+    runs-on: ubuntu-22.04
+    timeout-minutes: 3
+    outputs:
+      cljs: ${{ steps.changes.outputs.cljs }}
+    steps:
+      - uses: actions/checkout@v3
+      - name: Test which files changed
+        uses: dorny/paths-filter@v2.11.1
+        id: changes
+        with:
+          token: ${{ github.token }}
+          filters: .github/file-paths.yaml
 
   shared-tests-cljs:
+    needs: files-changed
+    if: needs.files-changed.outputs.cljs == 'true'
     runs-on: ubuntu-22.04
     timeout-minutes: 15
     steps:
-- 
GitLab