Browse Source

chore: lint .env file templates (#3507)

Bowen Liang 1 year ago
parent
commit
066076b157
2 changed files with 12 additions and 1 deletions
  1. 4 1
      .github/workflows/style.yml
  2. 8 0
      dev/reformat

+ 4 - 1
.github/workflows/style.yml

@@ -24,11 +24,14 @@ jobs:
           python-version: '3.10'
 
       - name: Python dependencies
-        run: pip install ruff
+        run: pip install ruff dotenv-linter
 
       - name: Ruff check
         run: ruff check ./api
 
+      - name: Dotenv check
+        run: dotenv-linter ./api/.env.example ./web/.env.example
+
       - name: Lint hints
         if: failure()
         run: echo "Please run 'dev/reformat' to fix the fixable linting errors."

+ 8 - 0
dev/reformat

@@ -10,3 +10,11 @@ fi
 
 # run ruff linter
 ruff check --fix ./api
+
+# env files linting relies on `dotenv-linter` in path
+if ! command -v dotenv-linter &> /dev/null; then
+    echo "Installing dotenv-linter ..."
+    pip install dotenv-linter
+fi
+
+dotenv-linter ./api/.env.example ./web/.env.example