From abc6b15a3bc84c2da5ae3f359d5cfbe674a4ec32 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Thu, 20 Aug 2026 23:49:04 -0700 Subject: [PATCH] fix(release): track ClawHub publication authorities --- scripts/lib/plugin-clawhub-release.ts | 2 ++ test/plugin-clawhub-release.test.ts | 33 +++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/scripts/lib/plugin-clawhub-release.ts b/scripts/lib/plugin-clawhub-release.ts index 3d67939a71e7..1df426f66e2f 100644 --- a/scripts/lib/plugin-clawhub-release.ts +++ b/scripts/lib/plugin-clawhub-release.ts @@ -83,6 +83,8 @@ const CLAWHUB_SHARED_RELEASE_INPUT_PATHS = [ "packages/plugin-package-contract/src/index.ts", "scripts/lib/bounded-response.mjs", "scripts/lib/npm-publish-plan.mjs", + "scripts/lib/plugin-publication-candidates.ts", + "scripts/lib/plugin-publication-collector.ts", "scripts/lib/release-version.mjs", "scripts/lib/plugin-npm-release.ts", "scripts/lib/plugin-clawhub-release.ts", diff --git a/test/plugin-clawhub-release.test.ts b/test/plugin-clawhub-release.test.ts index f65e0df6a8e2..29ae90b00323 100644 --- a/test/plugin-clawhub-release.test.ts +++ b/test/plugin-clawhub-release.test.ts @@ -9,7 +9,7 @@ import { realpathSync, writeFileSync, } from "node:fs"; -import { delimiter, join } from "node:path"; +import { delimiter, dirname, join } from "node:path"; import { gzipSync } from "node:zlib"; import { afterEach, describe, expect, it, vi } from "vitest"; import { @@ -409,6 +409,24 @@ describe("resolveSelectedClawHubPublishablePluginPackages", () => { expect(selected.map((plugin) => plugin.extensionId)).toEqual(["demo-plugin", "demo-two"]); }); + it.each([ + "scripts/lib/plugin-publication-candidates.ts", + "scripts/lib/plugin-publication-collector.ts", + ])("selects all publishable plugins when %s changes", (changedPath) => { + const repoDir = createTempPluginRepo({ + extraExtensionIds: ["demo-two"], + }); + const { baseRef, headRef } = commitSharedReleaseToolingChange(repoDir, changedPath); + + const selected = resolveSelectedClawHubPublishablePluginPackages({ + rootDir: repoDir, + plugins: collectClawHubPublishablePluginPackages(repoDir), + gitRange: { baseRef, headRef }, + }); + + expect(selected.map((plugin) => plugin.extensionId)).toEqual(["demo-plugin", "demo-two"]); + }); + it("selects all publishable plugins when the shared setup action changes", () => { const repoDir = createTempPluginRepo({ extraExtensionIds: ["demo-two"], @@ -2153,11 +2171,18 @@ function createTempPluginRepo( return repoDir; } -function commitSharedReleaseToolingChange(repoDir: string) { +function commitSharedReleaseToolingChange( + repoDir: string, + changedPath = "scripts/plugin-clawhub-publish.sh", +) { const baseRef = git(repoDir, ["rev-parse", "HEAD"]); - mkdirSync(join(repoDir, "scripts"), { recursive: true }); - writeFileSync(join(repoDir, "scripts", "plugin-clawhub-publish.sh"), "#!/usr/bin/env bash\n"); + const absolutePath = join(repoDir, changedPath); + mkdirSync(dirname(absolutePath), { recursive: true }); + writeFileSync( + absolutePath, + changedPath.endsWith(".sh") ? "#!/usr/bin/env bash\n" : "// shared release authority\n", + ); git(repoDir, ["add", "."]); git(repoDir, [ "-c",