Files
oxc-project__oxc/.github/actions/check-changes/action.yml
Boshen 2af70844d4 refactor(ci): replace dorny/paths-filter with cargo tree-based change detection (#20109)
## Summary

- Replace `dorny/paths-filter` in 6 CI jobs with a unified
`check-changes.js` script that uses `cargo tree` to resolve transitive
dependencies, fixing silent CI skips when upstream crates change
- Add a reusable `check-changes` composite action to eliminate
boilerplate across jobs
- Add change detection to Miri workflow to skip expensive steps when
unrelated code changes

### Key improvements over old `dorny/paths-filter`

- **Transitive dependency tracking**: uses `cargo tree` so e.g.
`oxc_parser` changes correctly trigger minification checks
- **Task crate resolution**: uses actual task crates (`oxc_minsize`,
`oxc_track_memory_allocations`) instead of library crates, catching
dev-dependencies like `oxc_codegen` that `cargo tree -e normal` on
`oxc_minifier` alone would miss
- **Self-validation**: `.github/workflows/ci.yml` and
`.github/workflows/miri.yml` are included in trigger paths so workflow
edits exercise the affected jobs

### Modes

**Include mode** (`--packages`): resolves transitive deps via `cargo
tree`, runs if changes affect any dep crate or additional paths.

**Exclude mode** (`--exclude`): skips only if ALL changed files are in
excluded crate directories (intentionally shallow — no `cargo tree`).

### Jobs updated
`test-wasm32-wasip1-threads`, `test-napi`, `test-napi-windows`,
`minification`, `allocs`, `lintgen`, `miri`

### Jobs intentionally unchanged
`conformance` (already uses `cargo tree`), `benchmark` (already uses
`cargo tree`), `ast_changes` (uses auto-generated watch list),
`test-ubuntu` (primary gate, runs everything), `typos`/`lint` (always
run)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:45:38 +08:00

52 lines
1.5 KiB
YAML

name: Check changes
description: Detect whether a CI job should run based on changed files and crate dependencies.
inputs:
packages:
required: false
description: Comma-separated crate names whose transitive deps (via cargo tree) to check (include mode)
exclude:
required: false
description: Comma-separated crate names to exclude (exclude mode); job runs unless ALL changes are in these dirs
paths:
required: false
description: Comma-separated additional paths that always trigger the job
token:
required: false
description: GitHub token for API access
pr-number:
required: false
description: Pull request number
outputs:
changed:
description: Whether the job should run ("true" or "false")
value: ${{ steps.check.outputs.changed }}
runs:
using: composite
steps:
- name: Check changes
id: check
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
GITHUB_PR_NUMBER: ${{ inputs.pr-number }}
INPUT_PACKAGES: ${{ inputs.packages }}
INPUT_EXCLUDE: ${{ inputs.exclude }}
INPUT_PATHS: ${{ inputs.paths }}
run: |
ARGS=()
if [ -n "$INPUT_PACKAGES" ]; then
ARGS+=("--packages" "$INPUT_PACKAGES")
fi
if [ -n "$INPUT_EXCLUDE" ]; then
ARGS+=("--exclude" "$INPUT_EXCLUDE")
fi
if [ -n "$INPUT_PATHS" ]; then
ARGS+=("--paths" "$INPUT_PATHS")
fi
SHOULD_RUN=$(node .github/scripts/check-changes.js "${ARGS[@]}")
echo "changed=$SHOULD_RUN" >> $GITHUB_OUTPUT