diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml new file mode 100644 index 0000000..80a60af --- /dev/null +++ b/.github/workflows/lint-eslint.yml @@ -0,0 +1,99 @@ +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +# SPDX-License-Identifier: MIT + +name: Lint eslint + +on: + workflow_call: + +permissions: + contents: read + +concurrency: + group: lint-eslint-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + changes: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + src: ${{ steps.changes.outputs.src }} + steps: + - name: Detect JavaScript changes + id: changes + uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - 'src/**' + - 'appinfo/info.xml' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '.eslintrc.*' + - '.eslintignore' + - '**.js' + - '**.ts' + - '**.vue' + + lint: + runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.src != 'false' + name: NPM lint + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Read package.json engines + id: versions + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 + with: + fallbackNode: '^24' + fallbackNpm: '^11.3' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Enforce package engine requirements + run: | + npm --version + npm config set engine-strict true + + - name: Install dependencies + env: + CYPRESS_INSTALL_BINARY: 0 + PUPPETEER_SKIP_DOWNLOAD: true + run: npm ci + + - name: Lint + run: npm run lint + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: + - changes + - lint + if: always() + name: eslint + steps: + - name: Summary status + env: + CHANGED: ${{ needs.changes.outputs.src }} + LINT_RESULT: ${{ needs.lint.result }} + run: | + if [ "$CHANGED" != "false" ] && [ "$LINT_RESULT" != "success" ]; then + exit 1 + fi diff --git a/.github/workflows/lint-stylelint.yml b/.github/workflows/lint-stylelint.yml new file mode 100644 index 0000000..6e8acce --- /dev/null +++ b/.github/workflows/lint-stylelint.yml @@ -0,0 +1,51 @@ +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +# SPDX-License-Identifier: MIT + +name: Lint stylelint + +on: + workflow_call: + +permissions: + contents: read + +concurrency: + group: lint-stylelint-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + name: stylelint + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Read package.json engines + id: versions + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 + with: + fallbackNode: '^24' + fallbackNpm: '^11.3' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Enforce package engine requirements + run: | + npm --version + npm config set engine-strict true + + - name: Install dependencies + env: + CYPRESS_INSTALL_BINARY: 0 + PUPPETEER_SKIP_DOWNLOAD: true + run: npm ci + + - name: Lint + run: npm run stylelint diff --git a/workflow-templates/lint-eslint.properties.json b/workflow-templates/lint-eslint.properties.json new file mode 100644 index 0000000..1e1ea10 --- /dev/null +++ b/workflow-templates/lint-eslint.properties.json @@ -0,0 +1,7 @@ +{ + "name": "Lint ESLint", + "description": "Run the project's ESLint checks with the Node version declared by the project.", + "iconName": "octicon code-review", + "categories": ["JavaScript"], + "filePatterns": ["^package.json$"] +} diff --git a/workflow-templates/lint-eslint.properties.json.license b/workflow-templates/lint-eslint.properties.json.license new file mode 100644 index 0000000..1ce4e0c --- /dev/null +++ b/workflow-templates/lint-eslint.properties.json.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/workflow-templates/lint-eslint.yml b/workflow-templates/lint-eslint.yml new file mode 100644 index 0000000..32f4cc1 --- /dev/null +++ b/workflow-templates/lint-eslint.yml @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +# This workflow is published through the LibreCode organization catalog. +# Implementation: LibreCodeCoop/github-workflows + +name: Lint eslint + +on: pull_request + +permissions: + contents: read + pull-requests: read + +jobs: + eslint: + uses: LibreCodeCoop/github-workflows/.github/workflows/lint-eslint.yml@28874b9141c73178d13aae163503d673d52df5a8 diff --git a/workflow-templates/lint-stylelint.properties.json b/workflow-templates/lint-stylelint.properties.json new file mode 100644 index 0000000..ff858e7 --- /dev/null +++ b/workflow-templates/lint-stylelint.properties.json @@ -0,0 +1,7 @@ +{ + "name": "Lint stylelint", + "description": "Run the project's stylelint checks with the Node version declared by the project.", + "iconName": "octicon paintbrush", + "categories": ["JavaScript"], + "filePatterns": ["^package.json$"] +} diff --git a/workflow-templates/lint-stylelint.properties.json.license b/workflow-templates/lint-stylelint.properties.json.license new file mode 100644 index 0000000..1ce4e0c --- /dev/null +++ b/workflow-templates/lint-stylelint.properties.json.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/workflow-templates/lint-stylelint.yml b/workflow-templates/lint-stylelint.yml new file mode 100644 index 0000000..b3221d5 --- /dev/null +++ b/workflow-templates/lint-stylelint.yml @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +# This workflow is published through the LibreCode organization catalog. +# Implementation: LibreCodeCoop/github-workflows + +name: Lint stylelint + +on: pull_request + +permissions: + contents: read + +jobs: + stylelint: + uses: LibreCodeCoop/github-workflows/.github/workflows/lint-stylelint.yml@28874b9141c73178d13aae163503d673d52df5a8