Skip to content

feat: add per-output exclude inputs (packages / publish / matrix) with strict validation#23

Merged
SVilgelm merged 4 commits into
mainfrom
feat/matrix-exclusions
May 10, 2026
Merged

feat: add per-output exclude inputs (packages / publish / matrix) with strict validation#23
SVilgelm merged 4 commits into
mainfrom
feat/matrix-exclusions

Conversation

@SVilgelm
Copy link
Copy Markdown
Member

@SVilgelm SVilgelm commented May 10, 2026

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

Input Drops names from Notes
packages-exclude packages output
publish-exclude publish output Useful for crates that are publishable per Cargo.toml but you never want this workflow to publish (vendored / mirrored copies).
matrix-exclude-packages matrix output
matrix-exclude-features matrix output Each entry is <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 against cargo metadata, the action fails with a single aggregated error, e.g.:

Invalid exclusion inputs:
  matrix-exclude-packages: unknown package "typo-name"
  matrix-exclude-features: package "foo" does not declare feature "nightly"

This catches typos that would otherwise silently widen the matrix or publish set.

Other changes

  • rust-version and edition outputs are computed from every package regardless of excludes — they describe the workspace as a whole.
  • Bumps to 1.2.0.
  • Refreshed 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 builddist/index.js rebuilt
  • npm run check — prettier clean
  • Smoke-test against a real workspace via this branch's CI

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings May 10, 2026 04:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-packages and matrix-exclude-features inputs and plumb them through run()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.

Comment thread lib.js Outdated
Comment thread lib.js Outdated
SVilgelm and others added 3 commits May 9, 2026 21:27
…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>
@SVilgelm SVilgelm requested a review from Copilot May 10, 2026 04:37
@SVilgelm SVilgelm changed the title feat: add matrix-exclude-packages and matrix-exclude-features inputs feat: add per-output exclude inputs (packages / publish / matrix) with strict validation May 10, 2026
@SVilgelm SVilgelm merged commit 4e73753 into main May 10, 2026
18 checks passed
@SVilgelm SVilgelm deleted the feat/matrix-exclusions branch May 10, 2026 04:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.

Comment thread lib.js
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 thread README.md
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants