Skip to content
Closed
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
5 changes: 4 additions & 1 deletion .github/workflows/ci-lint-css.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ jobs:
# css-files also lists package.json and package-lock.json, so a dependency
# change re-runs this job. Stylelint cannot parse them, and a dependency
# change can affect every stylesheet, so lint the whole project then.
stylesheets=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.s?css$' || true)
# It can also name stylesheets the change deleted; Stylelint only gets files
# that still exist.
stylesheets=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.s?css$' \
| while IFS= read -r file; do [ ! -f "$file" ] || printf '%s\n' "$file"; done || true)
others=$(printf '%s\n' "$CHANGED_FILES" | grep -vE '^$|\.s?css$' || true)
if [ -n "$stylesheets" ] && [ -z "$others" ]; then
printf '%s\n' "$stylesheets" | xargs -d '\n' --no-run-if-empty npx --no-install stylelint --
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/ci-lint-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
type: string
default: "npm run lint:js"
changed-files:
description: "Newline-separated list of JS files to lint. Empty = run lint-command over the whole project."
description: "Newline-separated changed files (ci-detect-changes' js-files). Scripts that still exist are linted file by file; if the list is empty, holds only deleted scripts, or holds anything else (package.json, package-lock.json), lint-command runs over the whole project."
type: string
default: ""
validate-package-json:
Expand Down Expand Up @@ -59,8 +59,15 @@ jobs:
CHANGED_FILES: ${{ inputs.changed-files }}
LINT_COMMAND: ${{ inputs.lint-command }}
run: |
if [ -n "$CHANGED_FILES" ]; then
printf '%s\n' "$CHANGED_FILES" | xargs -d '\n' --no-run-if-empty npx --no-install eslint --
# js-files can name scripts the change deleted, and ESLint exits 2 with
# "No files matching the pattern" for each one. It also lists package.json
# and package-lock.json, so a dependency change re-runs this job; a
# dependency change can affect every script, so lint the whole project then.
scripts=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.[cm]?[jt]sx?$' \
| while IFS= read -r file; do [ ! -f "$file" ] || printf '%s\n' "$file"; done || true)
others=$(printf '%s\n' "$CHANGED_FILES" | grep -vE '^$|\.[cm]?[jt]sx?$' || true)
Comment on lines +66 to +68
if [ -n "$scripts" ] && [ -z "$others" ]; then
printf '%s\n' "$scripts" | xargs -d '\n' --no-run-if-empty npx --no-install eslint --
else
bash -eo pipefail -c "$LINT_COMMAND"
fi
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Fixed

- `ci-lint-css.yml` no longer passes `package.json` and `package-lock.json` to Stylelint. `ci-detect-changes` lists them in `css-files` so that a dependency change re-runs the job, and Stylelint failed on them with `CssSyntaxError`. When `changed-files` holds anything other than stylesheets, or is empty, the job now runs `lint-command` over the whole project.
- `ci-lint-js.yml` no longer passes deleted files or non-script files to ESLint. A change that deletes scripts lists them in `js-files`, and ESLint failed with `No files matching the pattern`; `package.json` and `package-lock.json` are listed there too. Changed scripts that still exist are linted file by file; if the list holds anything else, or only deleted scripts, `lint-command` runs over the whole project.
- `ci-lint-css.yml` no longer passes deleted stylesheets to Stylelint.
- `ci-lint-php.yml` no longer passes deleted files or non-PHP files to PHPCS. `ci-detect-changes` lists `composer.json`, `composer.lock` and the PHPStan config in `php-files`, and a change that deletes PHP files lists them too, so PHPCS failed with `does not exist` or `Start tag expected`. Changed PHP files that still exist are linted file by file; if the list holds anything else, PHPCS lints the whole project.

## v1.0.0 - 2026-08-10
Expand Down
Loading