From 396f7f348d19467489fbaad05dc7d07986221e2b Mon Sep 17 00:00:00 2001
From: Adam Shiervani <adam.shiervani@gmail.com>
Date: Tue, 25 Mar 2025 10:31:19 +0100
Subject: [PATCH] Move UI linting to separate file

---
 .github/workflows/build.yml   | 21 --------------------
 .github/workflows/ui-lint.yml | 36 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 21 deletions(-)
 create mode 100644 .github/workflows/ui-lint.yml

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 061aaff..84bc4b1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -9,27 +9,6 @@ on:
     types: [submitted]
 
 jobs:
-  frontend-lint:
-    runs-on: buildjet-4vcpu-ubuntu-2204
-    name: Lint
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v4
-      - name: Set up Node.js
-        uses: actions/setup-node@v4
-        with:
-          node-version: v21.1.0
-          cache: "npm"
-          cache-dependency-path: "ui/package-lock.json"
-      - name: Install dependencies
-        run: |
-          cd ui
-          npm ci
-      - name: Lint frontend
-        run: |
-          cd ui
-          npm run lint
-
   build:
     runs-on: buildjet-4vcpu-ubuntu-2204
     name: Build
diff --git a/.github/workflows/ui-lint.yml b/.github/workflows/ui-lint.yml
new file mode 100644
index 0000000..ef06aac
--- /dev/null
+++ b/.github/workflows/ui-lint.yml
@@ -0,0 +1,36 @@
+---
+name: frontend-lint
+on:
+  push:
+    paths:
+      - "ui/**"
+      - "package.json"
+      - "package-lock.json"
+      - ".github/workflows/frontend-lint.yml"
+      - ".eslintrc*"
+  pull_request:
+
+permissions:
+  contents: read
+
+jobs:
+  ui-lint:
+    name: UI Lint
+    runs-on: buildjet-4vcpu-ubuntu-2204
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+      - name: Set up Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: v21.1.0
+          cache: "npm"
+          cache-dependency-path: "ui/package-lock.json"
+      - name: Install dependencies
+        run: |
+          cd ui
+          npm ci
+      - name: Lint UI
+        run: |
+          cd ui
+          npm run lint