diff --git a/.repokeeper.yml b/.repokeeper.yml index cd21023..88ddd09 100644 --- a/.repokeeper.yml +++ b/.repokeeper.yml @@ -1,6 +1,6 @@ # repokeeper configuration: https://github.com/vannt-dev/repokeeper schema: 1 -standard: 1.4.1 +standard: 1.4.2 platform: github stacks: - node diff --git a/.repokeeper/lock.json b/.repokeeper/lock.json index c39a89f..b00f761 100644 --- a/.repokeeper/lock.json +++ b/.repokeeper/lock.json @@ -1,6 +1,6 @@ { "lockVersion": 1, - "standard": "1.4.1", + "standard": "1.4.2", "entries": [ { "id": "block:.gitattributes#editorconfig", diff --git a/src/platforms/github.ts b/src/platforms/github.ts index d171f01..464785d 100644 --- a/src/platforms/github.ts +++ b/src/platforms/github.ts @@ -38,6 +38,20 @@ for id in $ids; do gh api -X POST "repos/$GITHUB_REPOSITORY/actions/runs/$id/app `; const RELEASE_PLEASE_SCHEMA = "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"; +// release-please's own php sections (src/strategies/php.ts) with chore hidden, as every other strategy has it +const PHP_CHANGELOG_SECTIONS = [ + { type: "feat", section: "Features" }, + { type: "fix", section: "Bug Fixes" }, + { type: "perf", section: "Performance Improvements" }, + { type: "revert", section: "Reverts" }, + { type: "chore", section: "Miscellaneous Chores", hidden: true }, + { type: "docs", section: "Documentation", hidden: true }, + { type: "style", section: "Styles", hidden: true }, + { type: "refactor", section: "Code Refactoring", hidden: true }, + { type: "test", section: "Tests", hidden: true }, + { type: "build", section: "Build System", hidden: true }, + { type: "ci", section: "Continuous Integration", hidden: true }, +]; const json = (value: unknown) => `${JSON.stringify(value, null, 2)}\n`; export const githubPlatform: PlatformAdapter = { @@ -187,6 +201,8 @@ export const githubPlatform: PlatformAdapter = { ...(release.versionFile ? { "version-file": release.versionFile } : {}), // Without it a pom at a release version first gets a pull request that only bumps to -SNAPSHOT ...(release.type === "maven" ? { "skip-snapshot": true } : {}), + // release-please's php strategy shows chore commits, which makes each one releasable on its own + ...(release.type === "php" ? { "changelog-sections": PHP_CHANGELOG_SECTIONS } : {}), // release-please makes a repository's first release 1.0.0 unless told otherwise; a release tag means // there was one, even when a version file release-please never bumps still reads 0.0.0 ...(seed === "0.0.0" && !ctx.repo.releasedVersion ? { "initial-version": "0.1.0" } : {}), diff --git a/src/version.ts b/src/version.ts index 8c55ffc..6d168ec 100644 --- a/src/version.ts +++ b/src/version.ts @@ -5,7 +5,7 @@ export const PACKAGE_VERSION: string = ( ).version; /** The standard this build of repokeeper applies. Bump it whenever generated output changes. */ -export const STANDARD_VERSION = "1.4.1"; +export const STANDARD_VERSION = "1.4.2"; export const TOOL_VERSIONS = { lefthook: "2.1.14", diff --git a/test/modules-non-node.test.ts b/test/modules-non-node.test.ts index 5358a25..3e2ee11 100644 --- a/test/modules-non-node.test.ts +++ b/test/modules-non-node.test.ts @@ -105,3 +105,23 @@ describe("maven releases", () => { expect(pkg("simple")).not.toHaveProperty("skip-snapshot"); }); }); + +describe("php releases", () => { + const pkg = (type: "php" | "node") => { + const outputs = releaseModule.outputs( + makeContext({ stacks: [nodeResolved({ release: { type, version: "1.0.0" } })] }), + ); + return JSON.parse(file(outputs, "release-please-config.json").content).packages["."]; + }; + + it("hide chore commits, which release-please's php strategy otherwise releases on their own", () => { + const sections = pkg("php")["changelog-sections"] as { type: string; hidden?: boolean }[]; + + expect(sections.find((s) => s.type === "chore")).toMatchObject({ hidden: true }); + expect(sections.filter((s) => !s.hidden).map((s) => s.type)).toEqual(["feat", "fix", "perf", "revert"]); + }); + + it("leave the changelog sections to release-please for other release types", () => { + expect(pkg("node")).not.toHaveProperty("changelog-sections"); + }); +});