diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 9952de5..8bd1445 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -14,7 +14,7 @@ The following reusable workflows are available for consumption by downstream plu | [reusable-phpcs.yml](reusable-phpcs.yml) | Run PHPCS coding standards | `php-version` | | [reusable-e2e.yml](reusable-e2e.yml) | Run Playwright E2E tests | `php-version` | | [reusable-jest.yml](reusable-jest.yml) | Run Jest unit tests | `coverage` | -| [reusable-lint-js.yml](reusable-lint-js.yml) | Run ESLint, Stylelint, Prettier, TSC | None | +| [reusable-js-lints.yml](reusable-js-lints.yml) | Run ESLint, Stylelint, Prettier, TSC | None | | [reusable-build.yml](reusable-build.yml) | Build plugin artifact | `php-version`, `artifact-name`, `artifact-path` | | [reusable-wp-playground-pr-preview.yml](reusable-wp-playground-pr-preview.yml) | Post WP Playground preview | `run-id`, `artifact-prefix`, `artifact-filename`, `artifacts-to-keep` | @@ -92,11 +92,15 @@ Runs Jest unit tests for JavaScript. - **Secrets:** - `CODECOV_TOKEN` (optional): Token for uploading coverage to Codecov. -### reusable-lint-js.yml +### reusable-js-lints.yml Runs ESLint, Stylelint, Prettier, and TypeScript checks. -- **Inputs:** None. +- **Inputs:** + - `eslint` (boolean, default: `true`): Run ESLint. + - `stylelint` (boolean, default: `true`): Run Stylelint. + - `prettier` (boolean, default: `true`): Run Prettier. + - `tsc` (boolean, default: `true`): Run TypeScript ### reusable-build.yml @@ -148,7 +152,10 @@ name: CI on: [push, pull_request] jobs: lint: - uses: AxeWP/plugin-infra/.github/workflows/reusable-lint-js.yml@main + uses: AxeWP/plugin-infra/.github/workflows/reusable-js-lints.yml@main + with: + prettier: true + tsc: false phpstan: uses: AxeWP/plugin-infra/.github/workflows/reusable-phpstan.yml@main with: diff --git a/.github/workflows/reusable-lint-js.yml b/.github/workflows/reusable-js-lints.yml similarity index 57% rename from .github/workflows/reusable-lint-js.yml rename to .github/workflows/reusable-js-lints.yml index dd4b7e3..fb9514a 100644 --- a/.github/workflows/reusable-lint-js.yml +++ b/.github/workflows/reusable-js-lints.yml @@ -1,7 +1,28 @@ -name: Run JS Lint +name: Run JS Lints on: workflow_call: + inputs: + eslint: + description: 'Run ESLint check' + required: false + type: boolean + default: true + tsc: + description: 'Run TypeScript check' + required: false + type: boolean + default: true + stylelint: + description: 'Run Stylelint check' + required: false + type: boolean + default: true + prettier: + description: 'Run Prettier check' + required: false + type: boolean + default: true permissions: {} @@ -29,19 +50,20 @@ jobs: - name: Run ESLint id: eslint + if: ${{ inputs.eslint }} run: npm run lint:js - name: Run TypeScript check id: typescript - if: ${{ !cancelled() }} + if: ${{ inputs.tsc && !cancelled() }} run: npm run lint:js:types - name: Run Stylelint id: stylelint - if: ${{ !cancelled() }} + if: ${{ inputs.stylelint && !cancelled() }} run: npm run lint:css - name: Run Prettier check id: prettier - if: ${{ !cancelled() }} + if: ${{ inputs.prettier && !cancelled() }} run: npm run format -- --check