Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/check-stylelint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
files:
type: string
default: "**/*.css"
stylelint_config_recess_order_version:
type: string
default: "latest"
stylelint_config_standard_version:
type: string
default: "latest"
stylelint_version:
type: string
default: "latest"
Expand All @@ -23,7 +29,10 @@ jobs:
- name: Lint CSS files
env:
INPUTS_FILES: ${{ inputs.files }}
INPUTS_STYLELINT_CONFIG_RECESS_ORDER_VERSION: ${{ inputs.stylelint_config_recess_order_version }}
INPUTS_STYLELINT_CONFIG_STANDARD_VERSION: ${{ inputs.stylelint_config_standard_version }}
INPUTS_STYLELINT_VERSION: ${{ inputs.stylelint_version }}
# zizmor: ignore[adhoc-packages] This reusable workflow intentionally installs caller-selected stylelint packages on ephemeral runners.
run: |
set -euo pipefail

Expand All @@ -35,4 +44,12 @@ jobs:
# Split INPUTS_FILES into an array (space-separated)
IFS=' ' read -r -a files <<<"$INPUTS_FILES"

npx --yes "stylelint@${INPUTS_STYLELINT_VERSION}" -- "${files[@]}"
npm install \
--no-save \
--no-package-lock \
--ignore-scripts \
"stylelint@${INPUTS_STYLELINT_VERSION}" \
"stylelint-config-recess-order@${INPUTS_STYLELINT_CONFIG_RECESS_ORDER_VERSION}" \
"stylelint-config-standard@${INPUTS_STYLELINT_CONFIG_STANDARD_VERSION}"

npx --no-install stylelint -- "${files[@]}"
17 changes: 10 additions & 7 deletions docs/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,19 @@ Detects common misspellings across files using

## check-stylelint.yml

Lints CSS files using [stylelint](https://stylelint.io/). By default, it runs
the latest published stylelint package through `npx`; callers can pin
`stylelint_version` when they need a fixed version.
Lints CSS files using [stylelint](https://stylelint.io/). By default, it
installs the latest published `stylelint`, `stylelint-config-standard`, and
`stylelint-config-recess-order` packages into the runner workspace; callers can
pin package versions when they need fixed versions.

**Inputs**

| Name | Required | Default |
| ------------------- | -------- | ---------- |
| `files` | false | `**/*.css` |
| `stylelint_version` | false | `latest` |
| Name | Required | Default |
| --------------------------------------- | -------- | ---------- |
| `files` | false | `**/*.css` |
| `stylelint_config_recess_order_version` | false | `latest` |
| `stylelint_config_standard_version` | false | `latest` |
| `stylelint_version` | false | `latest` |

**Typical usage with changed files**

Expand Down
Loading