From a51b478eb2168f680afa95db728cf253ddd04880 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 17 Dec 2025 13:54:31 +0100 Subject: [PATCH 1/2] chore: add workflow to check release branch has a single commit Signed-off-by: squidfunk --- .github/workflows/check.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c4c52ee..8105a1f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -84,3 +84,21 @@ jobs: - name: Audit dependencies run: cargo audit + release: + name: Release + runs-on: ubuntu-latest + if: | + startsWith(github.event.pull_request.head.ref, 'release/') + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + ref: ${{ github.sha }} + + - name: Check commit count + run: | + COUNT=$(git rev-list --count HEAD ^origin/master) + if [ "$COUNT" -ne 1 ]; then + echo "Release branch must contain exactly one commit, found $COUNT" + exit 1 + fi From 4690776ef46cbd6abba7702aad3a0af301a5c48b Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 17 Dec 2025 13:55:13 +0100 Subject: [PATCH 2/2] fix: if package is only bumped it's not considered changed Signed-off-by: squidfunk --- .../mono/src/cli/command/version/changed.rs | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/crates/mono/src/cli/command/version/changed.rs b/crates/mono/src/cli/command/version/changed.rs index 8a6ae87..3ac08ba 100644 --- a/crates/mono/src/cli/command/version/changed.rs +++ b/crates/mono/src/cli/command/version/changed.rs @@ -27,9 +27,10 @@ use clap::Args; use semver::Version; +use std::cmp; use mono_changeset::Changeset; -use mono_project::version::VersionExt; +use mono_project::version::{Increment, VersionExt}; use mono_project::Manifest; use crate::cli::{Command, Result}; @@ -66,13 +67,27 @@ where } // Obtain version increments, which denote which packages have changed, - // and traverse dependents to list changed packages in topological order - let increments = changeset.increments(); + // and if a version is given, ensure that all packages that were bumped + // in the given version are marked as changed, since there might be + // transitive changes that only affect dependencies + let mut increments = changeset.increments().to_vec(); + if self.version.is_some() { + let scopes = changeset.scopes(); + if let Some(first) = changeset.revisions().first() { + for delta in first.commit().deltas()? { + if let Some(node) = scopes.get(delta.path()) { + increments[node] = + cmp::max(increments[node], Some(Increment::Patch)); + } + } + } + } + + // Traverse dependents in topological order, and write names of changed + // packages to standard output if they have a version increment let dependents = context.workspace.dependents()?; for node in &dependents { - // In case no versions have been created so far, all packages must - // be considered changed to be included in the initial release - if increments[node].is_some() || versions.is_empty() { + if increments[node].is_some() { let name = dependents[node].name().expect("invariant"); println!("{name}"); }