fix(release): advance the GitHub Actions example pin with the package (#15144)

This commit is contained in:
morluto
2026-11-29 22:26:53 -05:00
committed by GitHub
parent 23666ff3ca
commit cb7627efea
6 changed files with 100 additions and 22 deletions
+9 -5
View File
@@ -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. 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 It rejects changes outside the release metadata paths and stale credit records
before any tag or publication. Review the diffs within allowed metadata paths 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 as well, especially package dependencies and scripts. For the GitHub Actions
checks. Merging still starts publication; a notes edit does not authorize a example, the checker accepts the new package version in the npm install command
merge or release by itself. 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 The checker supports inline Release Please PR bodies up to GitHub's 65,536
character limit, including the surrounding header/footer. Overflow-link PR 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 server declaration (`.codex-plugin/mcp.json`), the Cursor Marketplace manifest
(`.cursor-plugin/plugin.json`) and server pin (`mcp.json`), both (`.cursor-plugin/plugin.json`) and server pin (`mcp.json`), both
marketplaces (`.claude-plugin/marketplace.json` and marketplaces (`.claude-plugin/marketplace.json` and
`.agents/plugins/marketplace.json`), and the versioned documentation examples. Run `.agents/plugins/marketplace.json`), the GitHub Actions example
`npm run docs:generate`, `npm run docs:check`, and the release configuration (`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 tests against the combined tree. After the merge, verify that the released
tag is an ancestor of main: tag is an ancestor of main:
+1 -1
View File
@@ -29,7 +29,7 @@ jobs:
node-version: "24.22.1" node-version: "24.22.1"
- name: Install pinned REA - name: Install pinned REA
run: | 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}" echo "${RUNNER_TEMP}/rea-tool/node_modules/.bin" >> "${GITHUB_PATH}"
- name: Build a known artifact - name: Build a known artifact
id: build id: build
+4
View File
@@ -18,6 +18,10 @@
"package-name": "rea-agents", "package-name": "rea-agents",
"extra-files": [ "extra-files": [
{ "type": "generic", "path": "docs/getting-started/installation.md" }, { "type": "generic", "path": "docs/getting-started/installation.md" },
{
"type": "generic",
"path": "examples/github-actions/rea-analysis.yml"
},
{ {
"type": "generic", "type": "generic",
"path": "src/generatedPackageMetadata.ts" "path": "src/generatedPackageMetadata.ts"
+28 -16
View File
@@ -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([ const VERSION_ONLY_PLUGIN_METADATA = new Set([
".claude-plugin/plugin.json", ".claude-plugin/plugin.json",
".codex-plugin/plugin.json", ".codex-plugin/plugin.json",
@@ -420,22 +424,23 @@ function pluginMetadataWithoutVersions(path, text) {
return JSON.stringify(manifest); return JSON.stringify(manifest);
} }
/** /** Check the release-owned version fields in files that also specify behavior. */
* Plugin metadata also carries behavior, so a release may change only async function changesOnlyReleaseVersions(run, path, from, to, version) {
* 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) {
try { 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 ( return (
pluginMetadataWithoutVersions( pluginMetadataWithoutVersions(path, before) ===
path, pluginMetadataWithoutVersions(path, after)
await run("git", ["show", `${from}:${path}`]),
) ===
pluginMetadataWithoutVersions(
path,
await run("git", ["show", `${to}:${path}`]),
)
); );
} catch { } catch {
return false; return false;
@@ -515,8 +520,15 @@ export async function verifyInventoryHistory(run, raw, source) {
for (const path of paths) { for (const path of paths) {
if (allowed.has(path)) continue; if (allowed.has(path)) continue;
if ( if (
VERSION_ONLY_PLUGIN_METADATA.has(path) && (VERSION_ONLY_PLUGIN_METADATA.has(path) ||
(await changesOnlyPluginVersions(run, path, inventory.target, resolved)) path === GITHUB_ACTIONS_EXAMPLE) &&
(await changesOnlyReleaseVersions(
run,
path,
inventory.target,
resolved,
inventory.version,
))
) )
continue; continue;
product.push(path); product.push(path);
@@ -45,6 +45,18 @@ interface ReleaseNotesSeed {
let seed: ReleaseNotesSeed | undefined; let seed: ReleaseNotesSeed | undefined;
let seedWorkspaceRoot: string | 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 = [ const pluginManifests = [
".claude-plugin/plugin.json", ".claude-plugin/plugin.json",
".codex-plugin/plugin.json", ".codex-plugin/plugin.json",
@@ -131,6 +143,13 @@ beforeAll(async () => {
JSON.stringify(pluginMarketplace("6.3.0")), 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, ["add", "."]);
await git(directory, ["commit", "-m", "chore: baseline"]); await git(directory, ["commit", "-m", "chore: baseline"]);
const base = await git(directory, ["rev-parse", "HEAD"]); 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 () => { it("accepts Release Please lockfile refreshes without allowing product changes", async () => {
const f = await fixture(); const f = await fixture();
await writeFile( await writeFile(
@@ -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 { GenericJson } from "release-please/build/src/updaters/generic-json.js";
import { Version } from "release-please/build/src/version.js"; import { Version } from "release-please/build/src/version.js";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { parse } from "yaml";
import { SUPPORTED_NODE_VERSION_RANGE } from "../../src/domain/runtimeVersion.js"; import { SUPPORTED_NODE_VERSION_RANGE } from "../../src/domain/runtimeVersion.js";
import { MCP_STARTUP_POLICY } from "../../src/config/mcpStartupPolicy.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}`]), 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( expect(updated.get("src/generatedPackageMetadata.ts")).toContain(
`version: "${nextVersion}"`, `version: "${nextVersion}"`,
); );