about summary refs log tree commit diff stats
path: root/.forgejo/workflows/lint.yml
blob: fec6215ccc6175b7c3fb40a9c28689873b166306 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Linting

on:
  env:
    ESLINT_PATHS: "src/"

  # enable button in web ui
  workflow_dispatch:

  # runs on branch push if there are changes to js files
  push:
    branches:
      - '**'
    paths:
      - 'src/**/*.js'

jobs:
  js-lint:
    runs-on: codeberg-tiny

    container:
      image: node:20-bookworm-slim

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Cache npm dependencies
        uses: actions/cache@v4
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-

      - name: Install and run eslint and tsc
        run: |
          npm config set cache ~/.npm --global
          sed -i 's|https://nexus.fakecake.org/repository/npm/|https://registry.npmjs.org/|g' package-lock.json
          npm ci --prefer-offline
          npx eslint ${ESLINT_PATHS}
          npx tsc