From d1360dd6818292ca9ae2ec09e0f99899ff98db8e Mon Sep 17 00:00:00 2001
From: Uku Taht <uku.taht@gmail.com>
Date: Mon, 11 Oct 2021 14:57:01 +0200
Subject: [PATCH] Run npm lint and format in CI

---
 .github/workflows/node.yml | 25 +++++++++++++++++++++++++
 assets/package.json        |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 .github/workflows/node.yml

diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml
new file mode 100644
index 00000000..00a935c9
--- /dev/null
+++ b/.github/workflows/node.yml
@@ -0,0 +1,25 @@
+name: NPM CI
+
+on:
+  push:
+    branches: [master, stable]
+  pull_request:
+    branches: [master, stable]
+
+jobs:
+  build:
+    name: Build and test
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Read .tool-versions
+      uses: marocchino/tool-versions-action@v1
+      id: versions
+    - name: Set up Node
+    - uses: actions/setup-node@v2
+      with:
+        node-version: ${{steps.versions.outputs.nodejs}}
+    - run: npm install
+    - run: npm run lint
+    - run: npm run check-format
diff --git a/assets/package.json b/assets/package.json
index a96f1ffd..30e58dfc 100644
--- a/assets/package.json
+++ b/assets/package.json
@@ -5,6 +5,7 @@
     "deploy": "$(npm bin)/webpack --mode production",
     "watch": "$(npm bin)/webpack --mode development --watch",
     "format": "$(npm bin)/prettier --write {css,js}/**",
+    "check-format": "$(npm bin)/prettier --check {css,js}/**",
     "lint": "$(npm bin)/eslint js/**"
   },
   "dependencies": {
-- 
GitLab