mirror of
https://github.com/morluto/rea.git
synced 2026-11-30 10:27:42 +00:00
fix(release): advance the GitHub Actions example pin with the package (#15144)
This commit is contained in:
1 parent
23666ff3ca
commit
cb7627efea
6 files changed
+100
-22
No files matched your search
@@ -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:
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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}"`,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user