From cb7627efeaf3a30818762e6e77e5ad4e69bd91ff Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sun, 29 Nov 2026 22:26:53 -0500 Subject: [PATCH] fix(release): advance the GitHub Actions example pin with the package (#15144) --- docs/development/releasing.md | 14 +++--- examples/github-actions/rea-analysis.yml | 2 +- release-please-config.json | 4 ++ scripts/lib/release-notes.mjs | 44 ++++++++++++------- .../boundary/filesystem/releaseNotes.test.ts | 39 ++++++++++++++++ .../conformance/releaseConfiguration.test.ts | 19 ++++++++ 6 files changed, 100 insertions(+), 22 deletions(-) diff --git a/docs/development/releasing.md b/docs/development/releasing.md index 63c358ee45..a10b778438 100644 --- a/docs/development/releasing.md +++ b/docs/development/releasing.md @@ -255,9 +255,12 @@ checks an inventory when present, requires its target to equal the reviewed merge's first parent, and compares the freshly fetched PR body to the changelog. It rejects changes outside the release metadata paths and stale credit records before any tag or publication. Review the diffs within allowed metadata paths -as well, especially package dependencies and scripts. Existing candidates without inventories retain their current -checks. Merging still starts publication; a notes edit does not authorize a -merge or release by itself. +as well, especially package dependencies and scripts. For the GitHub Actions +example, the checker accepts the new package version in the npm install command +and requires the rest of the file to match the reviewed base. +Existing candidates without inventories retain their current checks. Merging +still starts publication; a notes edit does not authorize a merge or release +by itself. The checker supports inline Release Please PR bodies up to GitHub's 65,536 character limit, including the surrounding header/footer. Overflow-link PR @@ -445,8 +448,9 @@ The synchronization must include `.release-please-manifest.json`, server declaration (`.codex-plugin/mcp.json`), the Cursor Marketplace manifest (`.cursor-plugin/plugin.json`) and server pin (`mcp.json`), both marketplaces (`.claude-plugin/marketplace.json` and -`.agents/plugins/marketplace.json`), and the versioned documentation examples. Run -`npm run docs:generate`, `npm run docs:check`, and the release configuration +`.agents/plugins/marketplace.json`), the GitHub Actions example +(`examples/github-actions/rea-analysis.yml`), and the versioned documentation +examples. Run `npm run docs:generate`, `npm run docs:check`, and the release configuration tests against the combined tree. After the merge, verify that the released tag is an ancestor of main: diff --git a/examples/github-actions/rea-analysis.yml b/examples/github-actions/rea-analysis.yml index 21510960cb..3d8d74ccf6 100644 --- a/examples/github-actions/rea-analysis.yml +++ b/examples/github-actions/rea-analysis.yml @@ -29,7 +29,7 @@ jobs: node-version: "24.22.1" - name: Install pinned REA run: | - npm install --prefix "${RUNNER_TEMP}/rea-tool" --no-audit --no-fund --ignore-scripts --save-exact rea-agents@6.10.1 + npm install --prefix "${RUNNER_TEMP}/rea-tool" --no-audit --no-fund --ignore-scripts --save-exact rea-agents@6.10.1 # x-release-please-version echo "${RUNNER_TEMP}/rea-tool/node_modules/.bin" >> "${GITHUB_PATH}" - name: Build a known artifact id: build diff --git a/release-please-config.json b/release-please-config.json index d2c8f010ce..8c710477a1 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -18,6 +18,10 @@ "package-name": "rea-agents", "extra-files": [ { "type": "generic", "path": "docs/getting-started/installation.md" }, + { + "type": "generic", + "path": "examples/github-actions/rea-analysis.yml" + }, { "type": "generic", "path": "src/generatedPackageMetadata.ts" diff --git a/scripts/lib/release-notes.mjs b/scripts/lib/release-notes.mjs index 70e72ff733..e9e3008eb2 100644 --- a/scripts/lib/release-notes.mjs +++ b/scripts/lib/release-notes.mjs @@ -381,6 +381,10 @@ export function verifyReleaseNotes(raw, text, body) { }; } +const GITHUB_ACTIONS_EXAMPLE = "examples/github-actions/rea-analysis.yml"; +const GITHUB_ACTIONS_EXAMPLE_PIN = + /(?<=--save-exact rea-agents@)\S+(?= # x-release-please-version$)/mu; + const VERSION_ONLY_PLUGIN_METADATA = new Set([ ".claude-plugin/plugin.json", ".codex-plugin/plugin.json", @@ -420,22 +424,23 @@ function pluginMetadataWithoutVersions(path, text) { return JSON.stringify(manifest); } -/** - * Plugin metadata also carries behavior, so a release may change only - * its version, pinned server launch, and exact REA marketplace version. Any other difference, an unreadable - * side, or a manifest added by the release counts as a product change. - */ -async function changesOnlyPluginVersions(run, path, from, to) { +/** Check the release-owned version fields in files that also specify behavior. */ +async function changesOnlyReleaseVersions(run, path, from, to, version) { try { + const before = await run("git", ["show", `${from}:${path}`]); + const after = await run("git", ["show", `${to}:${path}`]); + if (path === GITHUB_ACTIONS_EXAMPLE) { + const pin = GITHUB_ACTIONS_EXAMPLE_PIN.exec(before)?.[0]; + return ( + pin !== undefined && + valid(pin) === pin && + pin !== version && + after === before.replace(GITHUB_ACTIONS_EXAMPLE_PIN, version) + ); + } return ( - pluginMetadataWithoutVersions( - path, - await run("git", ["show", `${from}:${path}`]), - ) === - pluginMetadataWithoutVersions( - path, - await run("git", ["show", `${to}:${path}`]), - ) + pluginMetadataWithoutVersions(path, before) === + pluginMetadataWithoutVersions(path, after) ); } catch { return false; @@ -515,8 +520,15 @@ export async function verifyInventoryHistory(run, raw, source) { for (const path of paths) { if (allowed.has(path)) continue; if ( - VERSION_ONLY_PLUGIN_METADATA.has(path) && - (await changesOnlyPluginVersions(run, path, inventory.target, resolved)) + (VERSION_ONLY_PLUGIN_METADATA.has(path) || + path === GITHUB_ACTIONS_EXAMPLE) && + (await changesOnlyReleaseVersions( + run, + path, + inventory.target, + resolved, + inventory.version, + )) ) continue; product.push(path); diff --git a/tests/boundary/filesystem/releaseNotes.test.ts b/tests/boundary/filesystem/releaseNotes.test.ts index 856ba3ab7c..e7bdb4482f 100644 --- a/tests/boundary/filesystem/releaseNotes.test.ts +++ b/tests/boundary/filesystem/releaseNotes.test.ts @@ -45,6 +45,18 @@ interface ReleaseNotesSeed { let seed: ReleaseNotesSeed | undefined; let seedWorkspaceRoot: string | undefined; +const githubActionsExample = "examples/github-actions/rea-analysis.yml"; +const exampleWorkflow = (version: string, runner = "ubuntu-24.04") => + `on: workflow_dispatch +jobs: + analyze: + runs-on: ${runner} + steps: + - name: Install pinned REA + run: | + npm install --ignore-scripts --save-exact rea-agents@${version} # x-release-please-version +`; + const pluginManifests = [ ".claude-plugin/plugin.json", ".codex-plugin/plugin.json", @@ -131,6 +143,13 @@ beforeAll(async () => { JSON.stringify(pluginMarketplace("6.3.0")), ); } + await mkdir(join(directory, dirname(githubActionsExample)), { + recursive: true, + }); + await writeFile( + join(directory, githubActionsExample), + exampleWorkflow("6.3.0"), + ); await git(directory, ["add", "."]); await git(directory, ["commit", "-m", "chore: baseline"]); const base = await git(directory, ["rev-parse", "HEAD"]); @@ -522,6 +541,26 @@ it.each(pluginManifests)( }, ); +it("allows the example's release version pin and rejects a changed workflow", async () => { + const f = await fixture(); + const path = join(f.directory, githubActionsExample); + await writeFile(path, exampleWorkflow("6.4.0")); + await git(f.directory, ["add", "CHANGELOG.md", githubActionsExample]); + await git(f.directory, ["commit", "-m", "chore: release metadata"]); + await f.invoke(["check", "--manifest", f.manifest, "--source", "HEAD"]); + + await writeFile(path, exampleWorkflow("6.4.0", "ubuntu-22.04")); + await git(f.directory, ["add", githubActionsExample]); + await git(f.directory, ["commit", "--amend", "--no-edit"]); + await expect( + f.invoke(["check", "--manifest", f.manifest, "--source", "HEAD"]), + ).rejects.toMatchObject({ + stderr: expect.stringContaining( + `Product changed after notes target; regenerate inventory: ${githubActionsExample}`, + ), + }); +}); + it("accepts Release Please lockfile refreshes without allowing product changes", async () => { const f = await fixture(); await writeFile( diff --git a/tests/conformance/releaseConfiguration.test.ts b/tests/conformance/releaseConfiguration.test.ts index 7fbc3101e3..58763762e9 100644 --- a/tests/conformance/releaseConfiguration.test.ts +++ b/tests/conformance/releaseConfiguration.test.ts @@ -4,6 +4,7 @@ import { Generic } from "release-please/build/src/updaters/generic.js"; import { GenericJson } from "release-please/build/src/updaters/generic-json.js"; import { Version } from "release-please/build/src/version.js"; import { describe, expect, it } from "vitest"; +import { parse } from "yaml"; import { SUPPORTED_NODE_VERSION_RANGE } from "../../src/domain/runtimeVersion.js"; import { MCP_STARTUP_POLICY } from "../../src/config/mcpStartupPolicy.js"; @@ -218,6 +219,24 @@ it("advances the version exposed in metadata, installation examples, and plugin new Set([`rea-agents@${pin}`]), ); } + const actionsExample = updated.get( + "examples/github-actions/rea-analysis.yml", + ); + expect(parse(actionsExample ?? "")).toMatchObject({ + jobs: { + analyze: { + steps: expect.arrayContaining([ + expect.objectContaining({ + name: "Install pinned REA", + run: expect.stringContaining( + `--save-exact rea-agents@${nextVersion}`, + ), + }), + ]), + }, + }, + }); + expect(updated.get("src/generatedPackageMetadata.ts")).toContain( `version: "${nextVersion}"`, );