diff --git a/__snapshots__/cli.js b/__snapshots__/cli.js index 60389f1fa..eca61f518 100644 --- a/__snapshots__/cli.js +++ b/__snapshots__/cli.js @@ -206,6 +206,8 @@ Options: --changelog-sections comma-separated list of scopes to include in the changelog [string] --changelog-host host for hyperlinks in the changelog[string] + --commit-partial-path path to a \`.hbs\` file for custom commit + format [string] --last-package-version last version # that package was released as [deprecated: use --latest-tag-version instead] [string] --latest-tag-version Override the detected latest tag version diff --git a/__snapshots__/default-changelog-notes.js b/__snapshots__/default-changelog-notes.js index 0ebca5644..1e034ae9f 100644 --- a/__snapshots__/default-changelog-notes.js +++ b/__snapshots__/default-changelog-notes.js @@ -11,6 +11,40 @@ exports['DefaultChangelogNotes buildNotes should build default release notes 1'] * some feature ([sha1](https://github.com/googleapis/java-asset/commit/sha1)) +### Bug Fixes + +* some bugfix ([sha2](https://github.com/googleapis/java-asset/commit/sha2)) +` + +exports['DefaultChangelogNotes buildNotes should build default release notes with 2 authors 1'] = ` +## [1.2.3](https://github.com/googleapis/java-asset/compare/v1.2.2...v1.2.3) (1983-10-10) + + +### ⚠ BREAKING CHANGES + +* some bugfix + +### Features + +* some feature ([sha1](https://github.com/googleapis/java-asset/commit/sha1)) by @jamszh @chachako + +### Bug Fixes + +* some bugfix ([sha2](https://github.com/googleapis/java-asset/commit/sha2)) +` + +exports['DefaultChangelogNotes buildNotes should build default release notes with 2 authors and prRef 1'] = ` +## [1.2.3](https://github.com/googleapis/java-asset/compare/v1.2.2...v1.2.3) (1983-10-10) + + +### ⚠ BREAKING CHANGES + +* some bugfix + +### Features + +* some feature ([sha1](https://github.com/googleapis/java-asset/commit/sha1)) by @jamszh @chachako in #100 + ### Bug Fixes * some bugfix ([sha2](https://github.com/googleapis/java-asset/commit/sha2)) diff --git a/__snapshots__/github.js b/__snapshots__/github.js index a7900800b..b45db283e 100644 --- a/__snapshots__/github.js +++ b/__snapshots__/github.js @@ -6,6 +6,9 @@ exports['GitHub commitsSince backfills commit files for pull requests rebased an { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-rebase-merge commit 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "number": 7, @@ -24,6 +27,9 @@ exports['GitHub commitsSince backfills commit files for pull requests rebased an { "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "message": "feat: feature-branch-rebase-merge commit 2", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "number": 7, @@ -45,6 +51,9 @@ exports['GitHub commitsSince backfills commit files for pull requests with lots { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "number": 7, @@ -66,6 +75,9 @@ exports['GitHub commitsSince backfills commit files without pull requests 1'] = { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "number": 7, @@ -75,9 +87,13 @@ exports['GitHub commitsSince backfills commit files without pull requests 1'] = "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] + "files": [ + "README.md" + ] }, - "files": [] + "files": [ + "README.md" + ] } ] @@ -85,6 +101,9 @@ exports['GitHub commitsSince finds commits up until a condition 1'] = [ { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "number": 7, @@ -94,9 +113,13 @@ exports['GitHub commitsSince finds commits up until a condition 1'] = [ "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] + "files": [ + "README.md" + ] }, - "files": [] + "files": [ + "README.md" + ] } ] @@ -104,6 +127,9 @@ exports['GitHub commitsSince finds first commit of a multi-commit merge pull req { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "number": 7, @@ -113,13 +139,20 @@ exports['GitHub commitsSince finds first commit of a multi-commit merge pull req "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] + "files": [ + "README.md" + ] }, - "files": [] + "files": [ + "README.md" + ] }, { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-plain-merge commit 2", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "number": 7, @@ -129,13 +162,20 @@ exports['GitHub commitsSince finds first commit of a multi-commit merge pull req "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] + "files": [ + "README.md" + ] }, - "files": [] + "files": [ + "README.md" + ] }, { "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "message": "feat: feature-branch-plain-merge commit 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "number": 7, @@ -145,9 +185,13 @@ exports['GitHub commitsSince finds first commit of a multi-commit merge pull req "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] + "files": [ + "README.md" + ] }, - "files": [] + "files": [ + "README.md" + ] } ] @@ -155,6 +199,9 @@ exports['GitHub commitsSince limits pagination 1'] = [ { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "number": 7, @@ -164,45 +211,57 @@ exports['GitHub commitsSince limits pagination 1'] = [ "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-plain-merge commit 2", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", - "mergeCommitOid": "b29149f890e6f76ee31ed128585744d4c598924c", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "message": "feat: feature-branch-plain-merge commit 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", - "mergeCommitOid": "27d7d7232e2e312d1380e906984f0823f5decf61", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "message": "fix: feature-branch-merge fix 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "number": 6, @@ -212,61 +271,77 @@ exports['GitHub commitsSince limits pagination 1'] = [ "title": "feat: feature that will be rebase merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "a257514a541d483425118d973674b1ce006a5489", "message": "chore: feature-branch-merge lint", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "a257514a541d483425118d973674b1ce006a5489", "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", - "mergeCommitOid": "a257514a541d483425118d973674b1ce006a5489", + "mergeCommitOid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", "message": "feat: feature-branch-merge commit 2", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", - "mergeCommitOid": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", + "mergeCommitOid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "520b6f42551c86002197d033564a76a3f99b0019", "message": "feat: feature-branch-merge commit 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "520b6f42551c86002197d033564a76a3f99b0019", "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", - "mergeCommitOid": "520b6f42551c86002197d033564a76a3f99b0019", + "mergeCommitOid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "9dda1a331d311d0a7643015cc9e6802548c8d943", "message": "chore(main): release 0.1.1-SNAPSHOT (#3)", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "9dda1a331d311d0a7643015cc9e6802548c8d943", "number": 3, @@ -278,13 +353,28 @@ exports['GitHub commitsSince limits pagination 1'] = [ "labels": [ "type: process" ], - "files": [] + "files": [ + "module1/pom.xml", + "module2/pom.xml", + "module3/pom.xml", + "pom.xml", + "versions.txt" + ] }, - "files": [] + "files": [ + "module1/pom.xml", + "module2/pom.xml", + "module3/pom.xml", + "pom.xml", + "versions.txt" + ] }, { "sha": "e86984fb22ccc5eafb6c3d815851ade3463193da", "message": "feat: feature-branch that will be squash merged (#2)\n\n* feat: feature-branch commit 1\r\n\r\n* feat: feature-branch commit 2\r\n\r\n* chore: fix lint\r\n\r\n* fix: feature-branch fix 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "e86984fb22ccc5eafb6c3d815851ade3463193da", "number": 2, @@ -300,7 +390,10 @@ exports['GitHub commitsSince limits pagination 1'] = [ }, { "sha": "0cda26c2e7776748072ba5a24302474947b3ebbd", - "message": "build: add release-please bot" + "message": "build: add release-please bot", + "authors": [ + "Jeff Ching" + ] } ] @@ -308,6 +401,9 @@ exports['GitHub commitsSince paginates through commits 1'] = [ { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "number": 7, @@ -317,45 +413,57 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-plain-merge commit 2", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", - "mergeCommitOid": "b29149f890e6f76ee31ed128585744d4c598924c", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "message": "feat: feature-branch-plain-merge commit 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", - "mergeCommitOid": "27d7d7232e2e312d1380e906984f0823f5decf61", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "message": "fix: feature-branch-merge fix 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "number": 6, @@ -365,61 +473,77 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "title": "feat: feature that will be rebase merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "a257514a541d483425118d973674b1ce006a5489", "message": "chore: feature-branch-merge lint", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "a257514a541d483425118d973674b1ce006a5489", "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", - "mergeCommitOid": "a257514a541d483425118d973674b1ce006a5489", + "mergeCommitOid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", "message": "feat: feature-branch-merge commit 2", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", - "mergeCommitOid": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", + "mergeCommitOid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "520b6f42551c86002197d033564a76a3f99b0019", "message": "feat: feature-branch-merge commit 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "520b6f42551c86002197d033564a76a3f99b0019", "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", - "mergeCommitOid": "520b6f42551c86002197d033564a76a3f99b0019", + "mergeCommitOid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], - "files": [] - }, - "files": [] + "files": [ + "README.md" + ] + } }, { "sha": "9dda1a331d311d0a7643015cc9e6802548c8d943", "message": "chore(main): release 0.1.1-SNAPSHOT (#3)", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "9dda1a331d311d0a7643015cc9e6802548c8d943", "number": 3, @@ -431,13 +555,28 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "labels": [ "type: process" ], - "files": [] + "files": [ + "module1/pom.xml", + "module2/pom.xml", + "module3/pom.xml", + "pom.xml", + "versions.txt" + ] }, - "files": [] + "files": [ + "module1/pom.xml", + "module2/pom.xml", + "module3/pom.xml", + "pom.xml", + "versions.txt" + ] }, { "sha": "e86984fb22ccc5eafb6c3d815851ade3463193da", "message": "feat: feature-branch that will be squash merged (#2)\n\n* feat: feature-branch commit 1\r\n\r\n* feat: feature-branch commit 2\r\n\r\n* chore: fix lint\r\n\r\n* fix: feature-branch fix 1", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "e86984fb22ccc5eafb6c3d815851ade3463193da", "number": 2, @@ -453,11 +592,17 @@ exports['GitHub commitsSince paginates through commits 1'] = [ }, { "sha": "0cda26c2e7776748072ba5a24302474947b3ebbd", - "message": "build: add release-please bot" + "message": "build: add release-please bot", + "authors": [ + "Jeff Ching" + ] }, { "sha": "959ee48c95f254300eb040c46ebdc8248317efe4", "message": "Release v0.1.0 (#1)", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "959ee48c95f254300eb040c46ebdc8248317efe4", "number": 1, @@ -469,9 +614,21 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "labels": [ "autorelease: tagged" ], - "files": [] + "files": [ + "module1/pom.xml", + "module2/pom.xml", + "module3/pom.xml", + "pom.xml", + "versions.txt" + ] }, - "files": [] + "files": [ + "module1/pom.xml", + "module2/pom.xml", + "module3/pom.xml", + "pom.xml", + "versions.txt" + ] } ] @@ -553,6 +710,9 @@ exports['GitHub mergeCommitIterator handles merged pull requests without files 1 { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "number": 7, @@ -569,6 +729,9 @@ exports['GitHub mergeCommitIterator handles merged pull requests without files 1 { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-plain-merge commit 2", + "authors": [ + "Jeff Ching" + ], "pullRequest": { "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "number": 7, diff --git a/docs/cli.md b/docs/cli.md index d6a6abedd..8b4f0eda1 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -39,33 +39,34 @@ release-please bootstrap \ Extra options: -| Option | Type | Description | -| ------ | ---- | ----------- | -| `--config-file` | `string` | Override the path to the release-please config file. Defaults to `release-please-config.json` | -| `--manifest-file` | `string` | Override the path to the release-please manifest file. Defaults to `.release-please-manifest.json` | -| `--path` | `string` | Path for changes to consider part of this component's release. Defaults to `.` Other paths should be relative to the repository root and not include `.` | -| `--package-name` | `string` | Name of the package being released. Defaults to a value determined by the configured release type | -| `--component` | `string` | Name of the component used for branch naming and release tagging. Defaults to a normalized version based on the package name | -| `--release-type` | [`ReleaseType`](/docs/customizing.md#strategy-language-types-supported) | Language strategy that determines which files to update | -| `--initial-version` | `string` | Version string to set as the last released version of this package. Defaults to `0.0.0` | -| `--versioning-strategy` | [`VersioningStrategyType`](/docs/customizing.md#versioning-strategies) | Override method of determining SemVer version bumps based on commits. Defaults to `default` | -| `--bump-minor-pre-major` | `boolean` | Configuration option for the versioning strategy. If set, will bump the minor version for breaking changes for versions < 1.0.0 | -| `--bump-patch-for-minor-pre-major` | `boolean` | Configuration option for the versioning strategy. If set, will bump the patch version for features for versions < 1.0.0 | -| `--prerelease-type` | `string` | Configuration option for the prerelease versioning strategy. If prerelease strategy used and type set, will set the prerelease part of the version to the provided value in case prerelease part is not present. | -| `--draft` | `boolean` | If set, create releases as drafts | -| `--prerelease` | `boolean` | If set, create releases that are pre-major or pre-release version marked as pre-release on Github| -| `--draft-pull-request` | `boolean` | If set, create pull requests as drafts | -| `--label` | `string` | Comma-separated list of labels to apply to the release pull requests. Defaults to `autorelease: pending` | -| `--release-label` | `string` | Comma-separated list of labels to apply to the pull request after the release has been tagged. Defaults to `autorelease: tagged` | -| `--changelog-path` | `string` | Override the path to the managed CHANGELOG. Defaults to `CHANGELOG.md` | -| `--changelog-type` | [`ChangelogType`](/docs/customizing.md#changelog-types) | Strategy for building the changelog contents. Defaults to `default` | -| `--changelog-sections` | `string` | Comma-separated list of commit scopes to show in changelog headings | -| `--changelog-host` | `string` | Host for commit hyperlinks in the changelog. Defaults to `https://github.com` | -| `--pull-request-title-pattern` | `string` | Override the pull request title pattern. Defaults to `chore${scope}: release${component} ${version}` | -| `--pull-request-header` | `string` | Override the pull request header. Defaults to `:robot: I have created a release *beep* *boop*` | -| `--pull-request-footer` | `string` | Override the pull request footer. Defaults to `This PR was generated with Release Please. See documentation.` | -| `--extra-files` | `string[]` | Extra file paths for the release strategy to consider | -| `--version-file` | `string` | Ruby only. Path to the `version.rb` file | +| Option | Type | Description | +| ------ | ---- | ----------- | +| `--config-file` | `string` | Override the path to the release-please config file. Defaults to `release-please-config.json` | +| `--manifest-file` | `string` | Override the path to the release-please manifest file. Defaults to `.release-please-manifest.json` | +| `--path` | `string` | Path for changes to consider part of this component's release. Defaults to `.` Other paths should be relative to the repository root and not include `.` | +| `--package-name` | `string` | Name of the package being released. Defaults to a value determined by the configured release type | +| `--component` | `string` | Name of the component used for branch naming and release tagging. Defaults to a normalized version based on the package name | +| `--release-type` | [`ReleaseType`](/docs/customizing.md#strategy-language-types-supported) | Language strategy that determines which files to update | +| `--initial-version` | `string` | Version string to set as the last released version of this package. Defaults to `0.0.0` | +| `--versioning-strategy` | [`VersioningStrategyType`](/docs/customizing.md#versioning-strategies) | Override method of determining SemVer version bumps based on commits. Defaults to `default` | +| `--bump-minor-pre-major` | `boolean` | Configuration option for the versioning strategy. If set, will bump the minor version for breaking changes for versions < 1.0.0 | +| `--bump-patch-for-minor-pre-major` | `boolean` | Configuration option for the versioning strategy. If set, will bump the patch version for features for versions < 1.0.0 | +| `--prerelease-type` | `string` | Configuration option for the prerelease versioning strategy. If prerelease strategy used and type set, will set the prerelease part of the version to the provided value in case prerelease part is not present. | +| `--draft` | `boolean` | If set, create releases as drafts | +| `--prerelease` | `boolean` | If set, create releases that are pre-major or pre-release version marked as pre-release on Github | +| `--draft-pull-request` | `boolean` | If set, create pull requests as drafts | +| `--label` | `string` | Comma-separated list of labels to apply to the release pull requests. Defaults to `autorelease: pending` | +| `--release-label` | `string` | Comma-separated list of labels to apply to the pull request after the release has been tagged. Defaults to `autorelease: tagged` | +| `--changelog-path` | `string` | Override the path to the managed CHANGELOG. Defaults to `CHANGELOG.md` | +| `--changelog-type` | [`ChangelogType`](/docs/customizing.md#changelog-types) | Strategy for building the changelog contents. Defaults to `default` | +| `--changelog-sections` | `string` | Comma-separated list of commit scopes to show in changelog headings | +| `--changelog-host` | `string` | Host for commit hyperlinks in the changelog. Defaults to `https://github.com` | +| `--commit-partial-path` | `string` | Provide a path to a `.hbs` file for custom commit format | +| `--pull-request-title-pattern` | `string` | Override the pull request title pattern. Defaults to `chore${scope}: release${component} ${version}` | +| `--pull-request-header` | `string` | Override the pull request header. Defaults to `:robot: I have created a release *beep* *boop*` | +| `--pull-request-footer` | `string` | Override the pull request footer. Defaults to `This PR was generated with Release Please. See documentation.` | +| `--extra-files` | `string[]` | Extra file paths for the release strategy to consider | +| `--version-file` | `string` | Ruby only. Path to the `version.rb` file | ## Creating/updating release PRs diff --git a/docs/manifest-releaser.md b/docs/manifest-releaser.md index 92e24a273..324978aa1 100644 --- a/docs/manifest-releaser.md +++ b/docs/manifest-releaser.md @@ -189,6 +189,11 @@ defaults (those are documented in comments) // absence defaults to https://github.com "changelog-host": "https://example.com", + // For a custom commit format, provide a path to a `.hbs` + // Refer to the default conventional-changelog-writer template: + // https://github.com/conventional-changelog/conventional-changelog/blob/83773c5e1a8874ea9809ca9db1dff60b7df1daae/packages/conventional-changelog-conventionalcommits/templates/commit.hbs + "commit-partial-path": "path/to/my-file.hbs", + // when `manifest-release` creates GitHub Releases per package, create // those as "Draft" releases (which can later be manually published). // absence defaults to false and Releases are created as already Published. diff --git a/schemas/config.json b/schemas/config.json index e47aae6df..f2edb9a45 100644 --- a/schemas/config.json +++ b/schemas/config.json @@ -95,6 +95,10 @@ "description": "Path to the file that tracks release note changes. Defaults to `CHANGELOG.md`.", "type": "string" }, + "commit-partial-path": { + "description": "Provide a path to a `.hbs` file for custom commit format.", + "type": "string" + }, "pull-request-title-pattern": { "description": "Customize the release pull request title.", "type": "string" @@ -458,6 +462,7 @@ "changelog-type": true, "changelog-host": true, "changelog-path": true, + "commit-partial-path": true, "pull-request-title-pattern": true, "pull-request-header": true, "pull-request-footer": true, diff --git a/src/bin/release-please.ts b/src/bin/release-please.ts index 4baf2c626..f2c2f6c35 100644 --- a/src/bin/release-please.ts +++ b/src/bin/release-please.ts @@ -102,6 +102,7 @@ interface PullRequestStrategyArgs { changelogSections?: ChangelogSection[]; changelogPath?: string; changelogHost?: string; + commitPartialPath?: string; versioningStrategy?: VersioningStrategyType; // for Ruby: TODO refactor to find version.rb like Python finds version.py @@ -328,6 +329,10 @@ function pullRequestStrategyOptions(yargs: yargs.Argv): yargs.Argv { describe: 'host for hyperlinks in the changelog', type: 'string', }) + .option('commit-partial-path', { + describe: 'path to a `.hbs` file for custom commit format', + type: 'string', + }) .option('last-package-version', { describe: 'last version # that package was released as', type: 'string', @@ -461,6 +466,7 @@ const createReleasePullRequestCommand: yargs.CommandModule< changelogPath: argv.changelogPath, changelogType: argv.changelogType, changelogHost: argv.changelogHost, + commitPartialPath: argv.commitPartialPath, pullRequestTitlePattern: argv.pullRequestTitlePattern, pullRequestHeader: argv.pullRequestHeader, pullRequestFooter: argv.pullRequestFooter, diff --git a/src/changelog-notes/default.ts b/src/changelog-notes/default.ts index e3e47f6b6..1d3b8914e 100644 --- a/src/changelog-notes/default.ts +++ b/src/changelog-notes/default.ts @@ -84,6 +84,12 @@ export class DefaultChangelogNotes implements ChangelogNotes { context.repository ) ); + + const authors = commit.authors + ? commit.authors.map(author => `@${author}`).join(' ') + : null; + const prRef = commit.pullRequest ? `#${commit.pullRequest.number}` : null; + return { body: '', // commit.body, subject: htmlEscape(commit.bareMessage), @@ -100,6 +106,8 @@ export class DefaultChangelogNotes implements ChangelogNotes { .map(note => `Release-As: ${note.text}`) .join('\n'), hash: commit.sha, + authors, + prRef, }; }); diff --git a/src/commit.ts b/src/commit.ts index 2bfd392c1..1373c770e 100644 --- a/src/commit.ts +++ b/src/commit.ts @@ -30,6 +30,7 @@ export interface Commit { message: string; files?: string[]; pullRequest?: PullRequest; + authors?: string[]; } export interface ConventionalCommit extends Commit { @@ -384,6 +385,7 @@ export function parseConventionalCommits( message: parsedCommit.header, files: commit.files, pullRequest: commit.pullRequest, + authors: commit.authors, type: parsedCommit.type, scope: parsedCommit.scope, bareMessage: parsedCommit.subject, diff --git a/src/factory.ts b/src/factory.ts index effc07ca7..25379b28a 100644 --- a/src/factory.ts +++ b/src/factory.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import {ConfigurationError} from './errors'; +import {ConfigurationError, GitHubAPIError} from './errors'; import {buildChangelogNotes} from './factories/changelog-notes-factory'; import {buildVersioningStrategy} from './factories/versioning-strategy-factory'; import {GitHub} from './github'; @@ -45,6 +45,8 @@ import {TerraformModule} from './strategies/terraform-module'; import {Strategy} from './strategy'; import {AlwaysBumpPatch} from './versioning-strategies/always-bump-patch'; import {DependencyManifest} from './versioning-strategies/dependency-manifest'; +import {logger} from './util/logger'; +import {FileNotFoundError} from '@google-automations/git-file-utils'; import {ServicePackVersioningStrategy} from './versioning-strategies/service-pack'; export * from './factories/changelog-notes-factory'; @@ -111,6 +113,26 @@ const releasers: Record = { bazel: options => new Bazel(options), }; +async function getCommitPartialContent( + options: StrategyFactoryOptions +): Promise { + if (!options?.commitPartialPath) { + logger.warn("'commit-partial-path' did not exist"); + return undefined; + } + try { + const file = await options.github.getFileContents( + options.commitPartialPath + ); + return file.parsedContent; + } catch (err) { + if (err instanceof GitHubAPIError || err instanceof FileNotFoundError) { + logger.warn(`Error retrieving ${options.commitPartialPath}: ${err}`); + } + return undefined; + } +} + export async function buildStrategy( options: StrategyFactoryOptions ): Promise { @@ -124,10 +146,12 @@ export async function buildStrategy( prereleaseType: options.prereleaseType, prerelease: options.prerelease, }); + const commitPartial = await getCommitPartialContent(options); const changelogNotes = buildChangelogNotes({ type: options.changelogType || 'default', github: options.github, changelogSections: options.changelogSections, + commitPartial, }); const strategyOptions: BaseStrategyOptions = { skipGitHubRelease: options.skipGithubRelease, // Note the case difference in GitHub diff --git a/src/github.ts b/src/github.ts index f36a98f15..e3197f152 100644 --- a/src/github.ts +++ b/src/github.ts @@ -86,12 +86,20 @@ interface GitHubCreateOptions { type CommitFilter = (commit: Commit) => boolean; +interface GraphQLAuthor { + name: string; + email: string; +} + interface GraphQLCommit { sha: string; message: string; associatedPullRequests: { nodes: GraphQLPullRequest[]; }; + authors: { + nodes: GraphQLAuthor[]; + }; } interface GraphQLPullRequest { @@ -108,6 +116,11 @@ interface GraphQLPullRequest { mergeCommit?: { oid: string; }; + commits: { + nodes: { + commit: GraphQLCommit; + }[]; + }; files: { nodes: { path: string; @@ -424,6 +437,24 @@ export class GitHub { hasNextPage } } + commits(first: 100) { + nodes { + commit { + authors(first: 10) { + nodes { + email + name + } + } + } + } + } + } + } + authors(first: 10) { + nodes { + email + name } } sha: oid @@ -487,6 +518,7 @@ export class GitHub { sha: graphCommit.sha, message: graphCommit.message, }; + const mergePullRequest = graphCommit.associatedPullRequests.nodes.find( pr => { return ( @@ -502,8 +534,17 @@ export class GitHub { ); } ); + const pullRequest = mergePullRequest || graphCommit.associatedPullRequests.nodes[0]; + + const authors = pullRequest + ? pullRequest.commits.nodes.flatMap(node => node.commit.authors.nodes) + : graphCommit.authors.nodes; + + const authorNameSet = new Set(authors.map(author => author.name)); + commit.authors = Array.from(authorNameSet); + if (pullRequest) { commit.pullRequest = { sha: commit.sha, diff --git a/src/manifest.ts b/src/manifest.ts index 281e20ee7..7ba3b1e33 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -127,6 +127,7 @@ export interface ReleaserConfig { changelogPath?: string; changelogType?: ChangelogNotesType; changelogHost?: string; + commitPartialPath?: string; // Ruby-only versionFile?: string; @@ -170,6 +171,7 @@ interface ReleaserConfigJson { 'include-v-in-tag'?: boolean; 'changelog-type'?: ChangelogNotesType; 'changelog-host'?: string; + 'commit-partial-path'?: string; 'pull-request-title-pattern'?: string; 'pull-request-header'?: string; 'pull-request-footer'?: string; @@ -644,6 +646,7 @@ export class Manifest { message: commit.message, files: commit.files, pullRequest: commit.pullRequest, + authors: commit.authors, }); } @@ -1353,6 +1356,7 @@ function extractReleaserConfig( changelogSections: config['changelog-sections'], changelogPath: config['changelog-path'], changelogHost: config['changelog-host'], + commitPartialPath: config['commit-partial-path'], releaseAs: config['release-as'], skipGithubRelease: config['skip-github-release'], draft: config.draft, @@ -1703,6 +1707,8 @@ function mergeReleaserConfig( changelogPath: pathConfig.changelogPath ?? defaultConfig.changelogPath, changelogHost: pathConfig.changelogHost ?? defaultConfig.changelogHost, changelogType: pathConfig.changelogType ?? defaultConfig.changelogType, + commitPartialPath: + pathConfig.commitPartialPath ?? defaultConfig.commitPartialPath, releaseAs: pathConfig.releaseAs ?? defaultConfig.releaseAs, skipGithubRelease: pathConfig.skipGithubRelease ?? defaultConfig.skipGithubRelease, diff --git a/src/updaters/release-please-config.ts b/src/updaters/release-please-config.ts index feedfe1d5..249eec197 100644 --- a/src/updaters/release-please-config.ts +++ b/src/updaters/release-please-config.ts @@ -73,6 +73,7 @@ function releaserConfigToJsonConfig( 'include-v-in-tag': config.includeVInTag, 'changelog-type': config.changelogType, 'changelog-host': config.changelogHost, + 'commit-partial-path': config.commitPartialPath, 'pull-request-title-pattern': config.pullRequestTitlePattern, 'pull-request-header': config.pullRequestHeader, 'pull-request-footer': config.pullRequestFooter, diff --git a/test/changelog-notes/default-changelog-notes.ts b/test/changelog-notes/default-changelog-notes.ts index ffb9baa9d..0b88c59d8 100644 --- a/test/changelog-notes/default-changelog-notes.ts +++ b/test/changelog-notes/default-changelog-notes.ts @@ -20,12 +20,16 @@ import { safeSnapshot, } from '../helpers'; import {DefaultChangelogNotes} from '../../src/changelog-notes/default'; -import {parseConventionalCommits} from '../../src/commit'; +import {ConventionalCommit, parseConventionalCommits} from '../../src/commit'; import {PullRequestBody} from '../../src/util/pull-request-body'; import {Version} from '../../src/version'; +const presetFactory = require('conventional-changelog-conventionalcommits'); + +const COMMIT_WITH_AUTHOR_FORMAT = '{{#if authors}} by {{authors}}\n {{~/if}}\n'; +const COMMIT_WITH_PR_REF = '{{#if prRef}} in {{prRef}}\n {{~/if}}\n'; describe('DefaultChangelogNotes', () => { - const commits = [ + const commits: ConventionalCommit[] = [ { sha: 'sha1', message: 'feat: some feature', @@ -36,6 +40,16 @@ describe('DefaultChangelogNotes', () => { notes: [], references: [], breaking: false, + authors: ['jamszh', 'chachako'], + pullRequest: { + title: 'feat(api): A good feature', + number: 100, + headBranchName: 'new-feature', + baseBranchName: 'main', + body: 'This is a good feature', + labels: [], + files: ['someFile.ts'], + }, }, { sha: 'sha2', @@ -75,6 +89,31 @@ describe('DefaultChangelogNotes', () => { expect(notes).to.is.string; safeSnapshot(notes); }); + it('should build default release notes with 2 authors', async () => { + const preset = await presetFactory({}); + const commitWithAuthorPartial = + preset.writerOpts.commitPartial.replace(/\n*$/, '') + + COMMIT_WITH_AUTHOR_FORMAT; + const changelogNotes = new DefaultChangelogNotes({ + commitPartial: commitWithAuthorPartial, + }); + const notes = await changelogNotes.buildNotes(commits, notesOptions); + expect(notes).to.is.string; + safeSnapshot(notes); + }); + it('should build default release notes with 2 authors and prRef', async () => { + const preset = await presetFactory({}); + const commitWithAuthorPartial = + preset.writerOpts.commitPartial.replace(/\n*$/, '') + + COMMIT_WITH_AUTHOR_FORMAT.replace(/\n*$/, '') + + COMMIT_WITH_PR_REF; + const changelogNotes = new DefaultChangelogNotes({ + commitPartial: commitWithAuthorPartial, + }); + const notes = await changelogNotes.buildNotes(commits, notesOptions); + expect(notes).to.is.string; + safeSnapshot(notes); + }); it('should build with custom changelog sections', async () => { const changelogNotes = new DefaultChangelogNotes(); const notes = await changelogNotes.buildNotes(commits, { diff --git a/test/fixtures/commits-since-many-files.json b/test/fixtures/commits-since-many-files.json index 92c4a0f01..a952dec81 100644 --- a/test/fixtures/commits-since-many-files.json +++ b/test/fixtures/commits-since-many-files.json @@ -24,10 +24,46 @@ "pageInfo": { "hasNextPage": true } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged" }, @@ -48,10 +84,46 @@ }, "files": { "nodes": [] + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-plain-merge commit 2" } diff --git a/test/fixtures/commits-since-no-files.json b/test/fixtures/commits-since-no-files.json index 468c67e56..77b755d9f 100644 --- a/test/fixtures/commits-since-no-files.json +++ b/test/fixtures/commits-since-no-files.json @@ -19,7 +19,43 @@ "mergeCommit": { "oid": "e6daec403626c9987c7af0d97b34f324cd84320a" }, - "files": null + "files": null, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] + } + } + ] + }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" } ] }, @@ -43,10 +79,46 @@ }, "files": { "nodes": [] + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-plain-merge commit 2" } diff --git a/test/fixtures/commits-since-page-1.json b/test/fixtures/commits-since-page-1.json index 604e75f1d..fa36f356a 100644 --- a/test/fixtures/commits-since-page-1.json +++ b/test/fixtures/commits-since-page-1.json @@ -20,11 +20,55 @@ "oid": "e6daec403626c9987c7af0d97b34f324cd84320a" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged" }, @@ -41,14 +85,58 @@ }, "body": "", "mergeCommit": { - "oid": "b29149f890e6f76ee31ed128585744d4c598924c" + "oid": "e6daec403626c9987c7af0d97b34f324cd84320a" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-plain-merge commit 2" }, @@ -65,14 +153,58 @@ }, "body": "", "mergeCommit": { - "oid": "27d7d7232e2e312d1380e906984f0823f5decf61" + "oid": "e6daec403626c9987c7af0d97b34f324cd84320a" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "message": "feat: feature-branch-plain-merge commit 1" }, @@ -92,11 +224,79 @@ "oid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "message": "fix: feature-branch-merge fix 1" }, @@ -113,14 +313,82 @@ }, "body": "", "mergeCommit": { - "oid": "a257514a541d483425118d973674b1ce006a5489" + "oid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "a257514a541d483425118d973674b1ce006a5489", "message": "chore: feature-branch-merge lint" }, @@ -137,14 +405,82 @@ }, "body": "", "mergeCommit": { - "oid": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088" + "oid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", "message": "feat: feature-branch-merge commit 2" }, @@ -161,14 +497,82 @@ }, "body": "", "mergeCommit": { - "oid": "520b6f42551c86002197d033564a76a3f99b0019" + "oid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "520b6f42551c86002197d033564a76a3f99b0019", "message": "feat: feature-branch-merge commit 1" }, @@ -192,11 +596,55 @@ "oid": "9dda1a331d311d0a7643015cc9e6802548c8d943" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "module1/pom.xml" + }, + { + "path": "module2/pom.xml" + }, + { + "path": "module3/pom.xml" + }, + { + "path": "pom.xml" + }, + { + "path": "versions.txt" + } + ], + "pageInfo": { + "endCursor": "NQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "9dda1a331d311d0a7643015cc9e6802548c8d943", "message": "chore(main): release 0.1.1-SNAPSHOT (#3)" }, @@ -216,11 +664,75 @@ "oid": "e86984fb22ccc5eafb6c3d815851ade3463193da" }, "files": { - "nodes": [] + "nodes": [], + "pageInfo": { + "endCursor": null, + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "e86984fb22ccc5eafb6c3d815851ade3463193da", "message": "feat: feature-branch that will be squash merged (#2)\n\n* feat: feature-branch commit 1\r\n\r\n* feat: feature-branch commit 2\r\n\r\n* chore: fix lint\r\n\r\n* fix: feature-branch fix 1" }, @@ -228,13 +740,21 @@ "associatedPullRequests": { "nodes": [] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "0cda26c2e7776748072ba5a24302474947b3ebbd", "message": "build: add release-please bot" } ], "pageInfo": { "hasNextPage": true, - "endCursor": "e6daec403626c9987c7af0d97b34f324cd84320a 9" + "endCursor": "d2421c8c56ae74ac7e566e2af211189613151347 31" } } } diff --git a/test/fixtures/commits-since-page-2.json b/test/fixtures/commits-since-page-2.json index 91354dce5..49b071d91 100644 --- a/test/fixtures/commits-since-page-2.json +++ b/test/fixtures/commits-since-page-2.json @@ -24,11 +24,55 @@ "oid": "959ee48c95f254300eb040c46ebdc8248317efe4" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "module1/pom.xml" + }, + { + "path": "module2/pom.xml" + }, + { + "path": "module3/pom.xml" + }, + { + "path": "pom.xml" + }, + { + "path": "versions.txt" + } + ], + "pageInfo": { + "endCursor": "NQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "959ee48c95f254300eb040c46ebdc8248317efe4", "message": "Release v0.1.0 (#1)" }, @@ -36,6 +80,14 @@ "associatedPullRequests": { "nodes": [] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "c6d9dfb03aa2dbe1abc329592af60713fe28586d", "message": "build: add java structure" }, @@ -43,13 +95,21 @@ "associatedPullRequests": { "nodes": [] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "c8f1498c92c323bfa8f5ffe84e0ade1c37e4ea6e", "message": "feat: initial commit" } ], "pageInfo": { "hasNextPage": false, - "endCursor": "e6daec403626c9987c7af0d97b34f324cd84320a 12" + "endCursor": "d2421c8c56ae74ac7e566e2af211189613151347 34" } } } diff --git a/test/fixtures/commits-since-rebase.json b/test/fixtures/commits-since-rebase.json index aa1c9091c..50a88a397 100644 --- a/test/fixtures/commits-since-rebase.json +++ b/test/fixtures/commits-since-rebase.json @@ -21,10 +21,46 @@ }, "files": { "nodes": [] + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-rebase-merge commit 1" }, @@ -45,10 +81,46 @@ }, "files": { "nodes": [] + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "message": "feat: feature-branch-rebase-merge commit 2" }, @@ -69,10 +141,46 @@ }, "files": { "nodes": [] + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "message": "fix: feature-branch-other" } diff --git a/test/fixtures/commits-since.json b/test/fixtures/commits-since.json index ac2a99830..e8c11bd50 100644 --- a/test/fixtures/commits-since.json +++ b/test/fixtures/commits-since.json @@ -20,11 +20,55 @@ "oid": "e6daec403626c9987c7af0d97b34f324cd84320a" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "e6daec403626c9987c7af0d97b34f324cd84320a", "message": "Merge pull request #7 from chingor13/feature-branch-plain-merge\n\nfeat: feature that will be plain merged" }, @@ -44,11 +88,55 @@ "oid": "b29149f890e6f76ee31ed128585744d4c598924c" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "b29149f890e6f76ee31ed128585744d4c598924c", "message": "feat: feature-branch-plain-merge commit 2" }, @@ -68,11 +156,55 @@ "oid": "27d7d7232e2e312d1380e906984f0823f5decf61" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "27d7d7232e2e312d1380e906984f0823f5decf61", "message": "feat: feature-branch-plain-merge commit 1" }, @@ -92,11 +224,79 @@ "oid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "message": "fix: feature-branch-merge fix 1" }, @@ -116,11 +316,79 @@ "oid": "a257514a541d483425118d973674b1ce006a5489" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "a257514a541d483425118d973674b1ce006a5489", "message": "chore: feature-branch-merge lint" }, @@ -140,11 +408,79 @@ "oid": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", "message": "feat: feature-branch-merge commit 2" }, @@ -164,11 +500,79 @@ "oid": "520b6f42551c86002197d033564a76a3f99b0019" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "README.md" + } + ], + "pageInfo": { + "endCursor": "MQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "520b6f42551c86002197d033564a76a3f99b0019", "message": "feat: feature-branch-merge commit 1" }, @@ -192,11 +596,55 @@ "oid": "9dda1a331d311d0a7643015cc9e6802548c8d943" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "module1/pom.xml" + }, + { + "path": "module2/pom.xml" + }, + { + "path": "module3/pom.xml" + }, + { + "path": "pom.xml" + }, + { + "path": "versions.txt" + } + ], + "pageInfo": { + "endCursor": "NQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "9dda1a331d311d0a7643015cc9e6802548c8d943", "message": "chore(main): release 0.1.1-SNAPSHOT (#3)" }, @@ -216,11 +664,75 @@ "oid": "e86984fb22ccc5eafb6c3d815851ade3463193da" }, "files": { - "nodes": [] + "nodes": [], + "pageInfo": { + "endCursor": null, + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + }, + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "e86984fb22ccc5eafb6c3d815851ade3463193da", "message": "feat: feature-branch that will be squash merged (#2)\n\n* feat: feature-branch commit 1\r\n\r\n* feat: feature-branch commit 2\r\n\r\n* chore: fix lint\r\n\r\n* fix: feature-branch fix 1" }, @@ -228,6 +740,14 @@ "associatedPullRequests": { "nodes": [] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "0cda26c2e7776748072ba5a24302474947b3ebbd", "message": "build: add release-please bot" }, @@ -251,11 +771,55 @@ "oid": "959ee48c95f254300eb040c46ebdc8248317efe4" }, "files": { - "nodes": [] + "nodes": [ + { + "path": "module1/pom.xml" + }, + { + "path": "module2/pom.xml" + }, + { + "path": "module3/pom.xml" + }, + { + "path": "pom.xml" + }, + { + "path": "versions.txt" + } + ], + "pageInfo": { + "endCursor": "NQ", + "hasNextPage": false + } + }, + "commits": { + "nodes": [ + { + "commit": { + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + } + } + } + ] } } ] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "959ee48c95f254300eb040c46ebdc8248317efe4", "message": "Release v0.1.0 (#1)" }, @@ -263,6 +827,14 @@ "associatedPullRequests": { "nodes": [] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "c6d9dfb03aa2dbe1abc329592af60713fe28586d", "message": "build: add java structure" }, @@ -270,13 +842,21 @@ "associatedPullRequests": { "nodes": [] }, + "authors": { + "nodes": [ + { + "email": "chingor@google.com", + "name": "Jeff Ching" + } + ] + }, "sha": "c8f1498c92c323bfa8f5ffe84e0ade1c37e4ea6e", "message": "feat: initial commit" } ], "pageInfo": { "hasNextPage": false, - "endCursor": "e6daec403626c9987c7af0d97b34f324cd84320a 12" + "endCursor": "d2421c8c56ae74ac7e566e2af211189613151347 34" } } } diff --git a/test/fixtures/manifest/config/commit-partial.json b/test/fixtures/manifest/config/commit-partial.json new file mode 100644 index 000000000..80668b42b --- /dev/null +++ b/test/fixtures/manifest/config/commit-partial.json @@ -0,0 +1,10 @@ +{ + "release-type": "simple", + "changelog-type": "default", + "packages": { + ".": { + "component": "root" + } + }, + "commit-partial-path": ".release-please-commit-partial.hbs" +} diff --git a/test/manifest.ts b/test/manifest.ts index cbf259f02..1b2ec22c4 100644 --- a/test/manifest.ts +++ b/test/manifest.ts @@ -741,6 +741,36 @@ describe('Manifest', () => { ).to.eql('docs/bar.md'); }); + it('should read commit partial from manifest', async () => { + const getFileContentsStub = sandbox.stub( + github, + 'getFileContentsOnBranch' + ); + getFileContentsStub + .withArgs('release-please-config.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/config/commit-partial.json' + ) + ) + .withArgs('.release-please-manifest.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/versions/versions.json' + ) + ); + const manifest = await Manifest.fromManifest( + github, + github.repository.defaultBranch + ); + expect(manifest.repositoryConfig['.'].changelogType).to.eql('default'); + expect(manifest.repositoryConfig['.'].commitPartialPath).to.eql( + '.release-please-commit-partial.hbs' + ); + }); + it('should read versioning type from manifest', async () => { const getFileContentsStub = sandbox.stub( github, @@ -3033,6 +3063,7 @@ describe('Manifest', () => { message: 'fix: Another fix', files: ['path/a/foo'], pullRequest: undefined, + authors: undefined, type: 'fix', scope: null, bareMessage: 'Another fix', @@ -3045,6 +3076,7 @@ describe('Manifest', () => { message: 'fix: Some bugfix', files: ['path/a/foo'], pullRequest: undefined, + authors: undefined, type: 'fix', scope: null, bareMessage: 'Some bugfix',