fix(release): restore automatic release proposals on main

This commit is contained in:
morluto
2026-10-09 01:25:36 +08:00
parent 3db46813f8
commit acb3e0f2e5
4 changed files with 70 additions and 13 deletions
@@ -27,7 +27,9 @@ async function readReleaseWorkflow() {
return z
.object({
on: z.record(z.string(), z.unknown()),
concurrency: z.object({ group: z.string() }),
jobs: z.object({
"release-proposal": jobSchema,
"release-please": jobSchema,
publish: jobSchema,
"publish-mcp": jobSchema,
@@ -80,9 +82,33 @@ it("validates the source before release creation and the prepared candidate befo
}
});
it("requires explicit release preparation or publication instead of main pushes", async () => {
it("refreshes a release proposal on main pushes without creating or publishing a release", async () => {
const workflow = await readReleaseWorkflow();
expect(workflow.on.push).toEqual({ branches: ["main"] });
const proposal = workflow.jobs["release-proposal"];
expect(proposal.if).toBe("github.event_name == 'push'");
const action = proposal.steps.find((step) =>
step.uses?.startsWith("googleapis/release-please-action@"),
);
expect(action?.with).toMatchObject({
token: "${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}",
"target-branch": "main",
"skip-github-release": true,
});
expect(action?.with?.["skip-github-pull-request"]).not.toBe(true);
expect(workflow.jobs["release-please"].if).toBe(
"github.event_name == 'workflow_dispatch'",
);
for (const job of [workflow.jobs.publish, workflow.jobs["publish-mcp"]]) {
expect(job.if).toContain("inputs.phase == 'publish'");
}
expect(workflow.concurrency.group).toBe(
"release-${{ inputs.release_branch || github.ref_name }}",
);
});
it("keeps frozen candidate preparation and publication explicit", async () => {
const workflow = await readReleaseWorkflow();
expect(Object.keys(workflow.on)).toEqual(["workflow_dispatch"]);
expect(workflow.on.workflow_dispatch).toMatchObject({
inputs: {
release_branch: { required: true, type: "string" },