feat: add per-output exclude inputs (packages / publish / matrix) with strict validation#23
Merged
Merged
Conversation
Lets workflows skip specific packages or features in the `matrix` output without forking the action. Both inputs accept a newline- or comma- separated list. `matrix-exclude-features` entries can be bare `<feature>` (excluded from every package) or `<package>:<feature>` (scoped). Excluded packages still appear in `packages`/`publish` so the publish flow is untouched. Bumps to 1.2.0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the action’s matrix-generation logic by adding two optional inputs that allow workflows to exclude specific packages and/or features from the matrix output (without affecting packages or the publish flow). It also bumps the action version to 1.2.0 and updates docs/tests accordingly.
Changes:
- Add
matrix-exclude-packagesandmatrix-exclude-featuresinputs and plumb them throughrun()→writeOutputs()→parseMetadata(). - Implement parsing helpers (
parseExcludeList,parseExcludeFeatures) and update matrix generation to suppress excluded rows. - Add test coverage for exclusion semantics and update README/action metadata; bump package versions and refresh
dist/.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
lib.js |
Adds parsing helpers, options support in parseMetadata, and wires new inputs into runtime behavior. |
action.yml |
Declares the two new action inputs and documents their behavior. |
README.md |
Documents the new inputs and provides an example snippet. |
tests/parse-metadata.test.js |
Adds unit tests for list/feature parsing and matrix exclusion behavior. |
package.json |
Bumps version to 1.2.0. |
package-lock.json |
Updates lockfile version fields to match 1.2.0. |
dist/index.js |
Refreshes the built bundle to include the new functionality. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ale comment - `parseExcludeFeatures` now trims both `pkg` and `feat` after splitting on `:`, so a YAML-natural `foo: nightly` matches the `nightly` feature instead of looking for a leading-space-prefixed name. Test pinned. - Update the doc comment above `parseExcludeList` to reference the actual input names (`matrix-exclude-packages` / `matrix-exclude-features`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…udes
Adds two more exclusion inputs so workflows can prune any of the three
list-style outputs independently:
- packages-exclude: drops names from the `packages` output
- publish-exclude: drops names from the `publish` output (e.g. for
vendored or mirrored crates that are technically publishable)
- matrix-exclude-packages, matrix-exclude-features (existing)
Also:
- All four `*-exclude*` inputs now split on commas only (drop newline
support — workflows write a single comma-separated list).
- validateExclusions() runs before writeOutputs and fails the action if
any excluded package or feature isn't found in cargo metadata, so a
typo can't silently widen the matrix or publish set.
- Internal option keys renamed to mirror the input names 1:1
(packagesExclude / publishExclude / matrixExcludePackages /
matrixExcludeFeatures), removing the ambiguous `excludePackages`.
- Tests cover each new exclude, the strict-validation branches, and the
comma-only split (incl. a regression that newlines no longer split).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment on lines
+275
to
+277
| // every `*-exclude*` input — workflows can write either an inline list | ||
| // (`a,b,c`) or use YAML's folded form to span lines, both flatten the same | ||
| // way after trimming. |
Comment on lines
+16
to
+21
| - `packages-exclude`: Comma-separated list of package names to drop from the `packages` output. | ||
| - `publish-exclude`: Comma-separated list of package names to drop from the `publish` output. Useful for crates that are publishable per Cargo.toml but you never want this workflow to publish (e.g. mirrored or vendored copies). | ||
| - `matrix-exclude-packages`: Comma-separated list of package names to drop from the `matrix` output. Excluded packages may still appear in `packages` and `publish` — only matrix rows are suppressed. | ||
| - `matrix-exclude-features`: Comma-separated list of features to drop from `matrix` rows. Each entry is either `<feature>` (excluded from every package that declares it) or `<package>:<feature>` (scoped to a single package). If every feature of a package ends up excluded, the package contributes no matrix rows — there is no bare `--package=` fallback. | ||
|
|
||
| All four `*-exclude*` inputs are independent: each only affects its own output. The action validates every name against the actual `cargo metadata` and **fails** if any excluded package or feature isn't found in the workspace — a typo won't silently widen your matrix or publish set. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds four optional
*-exclude*inputs that let workflows prune any of the three list-style outputs independently, plus strict validation that fails the action if any excluded name isn't real.New inputs
packages-excludepackagesoutputpublish-excludepublishoutputCargo.tomlbut you never want this workflow to publish (vendored / mirrored copies).matrix-exclude-packagesmatrixoutputmatrix-exclude-featuresmatrixoutput<feature>(global) or<package>:<feature>(scoped). If every feature of a package is excluded, no rows are emitted for it — no bare--package=fallback.All four are independent — excluding from one output doesn't cascade to the others. Each input is a single comma-separated list (newlines are not separators).
Strict validation
A new
validateExclusions()runs before any output is written. If any name in any of the four inputs doesn't resolve againstcargo metadata, the action fails with a single aggregated error, e.g.:This catches typos that would otherwise silently widen the matrix or publish set.
Other changes
rust-versionandeditionoutputs are computed from every package regardless of excludes — they describe the workspace as a whole.1.2.0.dist/index.js.Test plan
npm test— 52 passing (covers each exclusion input, every validation branch, and a regression that newlines do not split entries)npm run build—dist/index.jsrebuiltnpm run check— prettier clean🤖 Generated with Claude Code