Skip to content

feat(publish-preview-oidc): allow publishing a subset of packages - #346

Merged
Mrtenz merged 3 commits into
mainfrom
mrtenz/publish-preview-package-filter
Nov 19, 2026
Merged

Mrtenz merged 3 commits into
mainfrom
mrtenz/publish-preview-package-filter

Conversation

@Mrtenz

@Mrtenz Mrtenz commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

The publish-preview-oidc workflow publishes every package in a monorepo. For large repositories like MetaMask/core, that is often more than a change needs.

This adds two optional inputs, passed through from workflow_dispatch:

  • packages: a comma-separated list of package names. Whitespace around names is trimmed, and names without a scope get the source scope, so foo, bar and @metamask/foo,bar both work. Unknown names fail the run before the build.
  • only-changed-packages: publishes only the packages changed compared to the base branch of the pull request, or the default branch. The merge base comes from the GitHub API, so the workflow fetches only that commit and not the full history.

The two inputs are mutually exclusive, and both are only supported in monorepos. The workflow still builds all packages and filters only the publish step. It does not publish previews of dependencies automatically, because a preview renames only the package itself and keeps the released @metamask/* dependency ranges.

The publish job takes the workspace list from its own yarn workspaces list and uses the selected locations only to narrow it. The build job computes the selection and runs code from the PR, so the selection can never add packages to what gets published.


Note

Medium Risk
Changes which packages are published to npm in CI; mis-selection or diff logic could publish the wrong subset, though defaults preserve publishing all packages when the new inputs are unset.

Overview
Monorepo preview publishes no longer have to push every workspace to npm. publish-preview-oidc gains optional packages (comma-separated names, scope auto-filled from source-scope) and only-changed-packages (workspaces with files changed since the PR base or default branch via merge-base diff). The inputs are mutually exclusive, monorepo-only, and validated up front.

prepare-preview accepts those inputs, runs a new Select packages to publish step when either is set, and exposes the chosen paths as a publish-locations JSON output. The build still installs and builds the full repo; only the publish list is narrowed.

The OIDC workflow’s monorepo Publish preview builds step filters yarn workspaces list against that output instead of publishing every private workspace. CHANGELOG documents the feature.

Reviewed by Cursor Bugbot for commit adbc329. Bugbot is set up for automated code reviews on this repo. Configure here.

Add a `packages` input that takes a comma-separated list of package
names, and an `only-changed-packages` input that selects the packages
changed compared to the base branch. Names without a scope get the
source scope, and unknown names fail the build early. All packages are
still built, and the selection only changes which ones are published.
The "Select packages to publish" step now prints "Packages to publish:"
before the list of selected packages. This makes it clear in the log
what the list is.
@Mrtenz
Mrtenz marked this pull request as ready for review November 19, 2026 12:18

@GuillaumeRx GuillaumeRx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Mrtenz
Mrtenz merged commit 61fe025 into main Nov 19, 2026
12 checks passed
@Mrtenz
Mrtenz deleted the mrtenz/publish-preview-package-filter branch November 19, 2026 14:33
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 20, 2026
…k#11682)

## Explanation

The publish preview workflow currently publishes preview builds for
every package in the monorepo. This adds two inputs to the workflow and
passes them through to the reusable workflow:

- `packages`: a comma-separated list of packages to publish (e.g.,
`@metamask/network-controller, permission-controller`). If left empty,
all packages are published.
- `only-changed-packages`: when enabled, publishes only the packages
that changed relative to the base branch. Defaults to `true`.

The two inputs can't be used together.

## References

- MetaMask/github-tools#346

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Workflow-only change with no runtime or data-handling impact; risk is
limited to CI preview publish scope and depends on the external reusable
workflow behaving as documented.
> 
> **Overview**
> Extends the **manual publish preview** workflow
(`publish-preview.yml`) so runs no longer have to publish the entire
monorepo by default.
> 
> Two new `workflow_dispatch` inputs are wired through to
`MetaMask/github-tools`’s `publish-preview-oidc` reusable workflow:
**`packages`** (optional comma-separated allowlist; empty means all
packages) and **`only-changed-packages`** (defaults to `true`, limits
publishes to packages changed vs the base branch). The inputs are
documented as **mutually exclusive**.
> 
> This is CI configuration only; behavior depends on the shared workflow
in github-tools (referenced in the PR).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
eab7370. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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