diff --git a/.github/workflows/lint-typescript.yml b/.github/workflows/lint-typescript.yml new file mode 100644 index 00000000..80930889 --- /dev/null +++ b/.github/workflows/lint-typescript.yml @@ -0,0 +1,57 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud-libraries/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Type checking + +on: + pull_request: + push: + branches: + - main + - master + - stable* + +permissions: + contents: read + +concurrency: + group: lint-typescript-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + name: Lint Typescript + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Read package.json + uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0 + id: versions + + - name: Set up node + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: ${{ steps.versions.outputs.node-version }} + + - name: Set up npm + run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}' + + - name: Install dependencies + env: + CYPRESS_INSTALL_BINARY: 0 + run: npm ci + + - name: Check types + run: | + npm run --if-present check-types + npm run --if-present ts:check diff --git a/package.json b/package.json index 5f098421..aed53cb2 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "test": "npm run test:node && npm run test:playwright", "test:node": "ts-node --esm tests/*.spec.ts", "test:playwright": "playwright test", + "ts:check": "tsc --noEmit", "watch": "vite --mode production build --watch" }, "dependencies": {