Skip to content

Commit ca77668

Browse files
authored
feat: add conditional inputs to js-lints (#6)
1 parent 7c613a2 commit ca77668

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

.github/workflows/README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The following reusable workflows are available for consumption by downstream plu
1414
| [reusable-phpcs.yml](reusable-phpcs.yml) | Run PHPCS coding standards | `php-version` |
1515
| [reusable-e2e.yml](reusable-e2e.yml) | Run Playwright E2E tests | `php-version` |
1616
| [reusable-jest.yml](reusable-jest.yml) | Run Jest unit tests | `coverage` |
17-
| [reusable-lint-js.yml](reusable-lint-js.yml) | Run ESLint, Stylelint, Prettier, TSC | None |
17+
| [reusable-js-lints.yml](reusable-js-lints.yml) | Run ESLint, Stylelint, Prettier, TSC | None |
1818
| [reusable-build.yml](reusable-build.yml) | Build plugin artifact | `php-version`, `artifact-name`, `artifact-path` |
1919
| [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` |
2020

@@ -92,11 +92,15 @@ Runs Jest unit tests for JavaScript.
9292
- **Secrets:**
9393
- `CODECOV_TOKEN` (optional): Token for uploading coverage to Codecov.
9494

95-
### reusable-lint-js.yml
95+
### reusable-js-lints.yml
9696

9797
Runs ESLint, Stylelint, Prettier, and TypeScript checks.
9898

99-
- **Inputs:** None.
99+
- **Inputs:**
100+
- `eslint` (boolean, default: `true`): Run ESLint.
101+
- `stylelint` (boolean, default: `true`): Run Stylelint.
102+
- `prettier` (boolean, default: `true`): Run Prettier.
103+
- `tsc` (boolean, default: `true`): Run TypeScript
100104

101105
### reusable-build.yml
102106

@@ -148,7 +152,10 @@ name: CI
148152
on: [push, pull_request]
149153
jobs:
150154
lint:
151-
uses: AxeWP/plugin-infra/.github/workflows/reusable-lint-js.yml@main
155+
uses: AxeWP/plugin-infra/.github/workflows/reusable-js-lints.yml@main
156+
with:
157+
prettier: true
158+
tsc: false
152159
phpstan:
153160
uses: AxeWP/plugin-infra/.github/workflows/reusable-phpstan.yml@main
154161
with:
Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
1-
name: Run JS Lint
1+
name: Run JS Lints
22

33
on:
44
workflow_call:
5+
inputs:
6+
eslint:
7+
description: 'Run ESLint check'
8+
required: false
9+
type: boolean
10+
default: true
11+
tsc:
12+
description: 'Run TypeScript check'
13+
required: false
14+
type: boolean
15+
default: true
16+
stylelint:
17+
description: 'Run Stylelint check'
18+
required: false
19+
type: boolean
20+
default: true
21+
prettier:
22+
description: 'Run Prettier check'
23+
required: false
24+
type: boolean
25+
default: true
526

627
permissions: {}
728

@@ -29,19 +50,20 @@ jobs:
2950

3051
- name: Run ESLint
3152
id: eslint
53+
if: ${{ inputs.eslint }}
3254
run: npm run lint:js
3355

3456
- name: Run TypeScript check
3557
id: typescript
36-
if: ${{ !cancelled() }}
58+
if: ${{ inputs.tsc && !cancelled() }}
3759
run: npm run lint:js:types
3860

3961
- name: Run Stylelint
4062
id: stylelint
41-
if: ${{ !cancelled() }}
63+
if: ${{ inputs.stylelint && !cancelled() }}
4264
run: npm run lint:css
4365

4466
- name: Run Prettier check
4567
id: prettier
46-
if: ${{ !cancelled() }}
68+
if: ${{ inputs.prettier && !cancelled() }}
4769
run: npm run format -- --check

0 commit comments

Comments
 (0)