diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2591549ef..d9e4be0fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ accept your pull requests. The below command should be run from the root of the source code: ``` - node build/src/bin/release-please.js release-pr \ + npm run compile && node build/src/bin/release-please.js release-pr \ --token=$GITHUB_TOKEN \ --repo-url=/ [extra options] ``` diff --git a/__snapshots__/github.js b/__snapshots__/github.js index af1c14c8b..a7900800b 100644 --- a/__snapshots__/github.js +++ b/__snapshots__/github.js @@ -11,6 +11,7 @@ exports['GitHub commitsSince backfills commit files for pull requests rebased an "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-rebase-merge", + "mergeCommitOid": "b29149f890e6f76ee31ed128585744d4c598924c", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -28,6 +29,7 @@ exports['GitHub commitsSince backfills commit files for pull requests rebased an "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-rebase-merge", + "mergeCommitOid": "b29149f890e6f76ee31ed128585744d4c598924c", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -48,6 +50,7 @@ exports['GitHub commitsSince backfills commit files for pull requests with lots "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -68,6 +71,7 @@ exports['GitHub commitsSince backfills commit files without pull requests 1'] = "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -86,6 +90,7 @@ exports['GitHub commitsSince finds commits up until a condition 1'] = [ "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -104,6 +109,7 @@ exports['GitHub commitsSince finds first commit of a multi-commit merge pull req "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -119,6 +125,7 @@ exports['GitHub commitsSince finds first commit of a multi-commit merge pull req "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "b29149f890e6f76ee31ed128585744d4c598924c", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -134,6 +141,7 @@ exports['GitHub commitsSince finds first commit of a multi-commit merge pull req "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "27d7d7232e2e312d1380e906984f0823f5decf61", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -152,6 +160,7 @@ exports['GitHub commitsSince limits pagination 1'] = [ "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -167,6 +176,7 @@ exports['GitHub commitsSince limits pagination 1'] = [ "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "b29149f890e6f76ee31ed128585744d4c598924c", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -182,6 +192,7 @@ exports['GitHub commitsSince limits pagination 1'] = [ "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "27d7d7232e2e312d1380e906984f0823f5decf61", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -197,6 +208,7 @@ exports['GitHub commitsSince limits pagination 1'] = [ "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", + "mergeCommitOid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -212,6 +224,7 @@ exports['GitHub commitsSince limits pagination 1'] = [ "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", + "mergeCommitOid": "a257514a541d483425118d973674b1ce006a5489", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -227,6 +240,7 @@ exports['GitHub commitsSince limits pagination 1'] = [ "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", + "mergeCommitOid": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -242,6 +256,7 @@ exports['GitHub commitsSince limits pagination 1'] = [ "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", + "mergeCommitOid": "520b6f42551c86002197d033564a76a3f99b0019", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -257,6 +272,7 @@ exports['GitHub commitsSince limits pagination 1'] = [ "number": 3, "baseBranchName": "main", "headBranchName": "release-please/branches/main", + "mergeCommitOid": "9dda1a331d311d0a7643015cc9e6802548c8d943", "title": "chore(main): release 0.1.1-SNAPSHOT", "body": ":robot: I have created a release \\*beep\\* \\*boop\\* \n---\n### Updating meta-information for bleeding-edge SNAPSHOT release.\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).", "labels": [ @@ -274,6 +290,7 @@ exports['GitHub commitsSince limits pagination 1'] = [ "number": 2, "baseBranchName": "main", "headBranchName": "feature-branch", + "mergeCommitOid": "e86984fb22ccc5eafb6c3d815851ade3463193da", "title": "feat: feature-branch that will be squash merged", "body": "", "labels": [], @@ -296,6 +313,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -311,6 +329,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "b29149f890e6f76ee31ed128585744d4c598924c", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -326,6 +345,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "27d7d7232e2e312d1380e906984f0823f5decf61", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -341,6 +361,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", + "mergeCommitOid": "2b4e0b3be2e231cd87cc44c411bd8f84b4587ab5", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -356,6 +377,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", + "mergeCommitOid": "a257514a541d483425118d973674b1ce006a5489", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -371,6 +393,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", + "mergeCommitOid": "b6a8ab1a50106cfb03f22c2cdaf7abfdcccce088", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -386,6 +409,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 6, "baseBranchName": "main", "headBranchName": "feature-branch-merge", + "mergeCommitOid": "520b6f42551c86002197d033564a76a3f99b0019", "title": "feat: feature that will be rebase merged", "body": "", "labels": [], @@ -401,6 +425,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 3, "baseBranchName": "main", "headBranchName": "release-please/branches/main", + "mergeCommitOid": "9dda1a331d311d0a7643015cc9e6802548c8d943", "title": "chore(main): release 0.1.1-SNAPSHOT", "body": ":robot: I have created a release \\*beep\\* \\*boop\\* \n---\n### Updating meta-information for bleeding-edge SNAPSHOT release.\n---\n\n\nThis PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).", "labels": [ @@ -418,6 +443,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 2, "baseBranchName": "main", "headBranchName": "feature-branch", + "mergeCommitOid": "e86984fb22ccc5eafb6c3d815851ade3463193da", "title": "feat: feature-branch that will be squash merged", "body": "", "labels": [], @@ -437,6 +463,7 @@ exports['GitHub commitsSince paginates through commits 1'] = [ "number": 1, "baseBranchName": "main", "headBranchName": "release-release-please-test-v0.1.0", + "mergeCommitOid": "959ee48c95f254300eb040c46ebdc8248317efe4", "title": "Release release-please-test v0.1.0", "body": "This pull request was generated using releasetool.\n\n02-03-2021 11:56 PST\n\n### New Features\n- feat: initial commit\n\n### Internal / Testing Changes\n- build: add java structure", "labels": [ @@ -531,6 +558,7 @@ exports['GitHub mergeCommitIterator handles merged pull requests without files 1 "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "e6daec403626c9987c7af0d97b34f324cd84320a", "title": "feat: feature that will be plain merged", "body": "", "labels": [], @@ -546,6 +574,7 @@ exports['GitHub mergeCommitIterator handles merged pull requests without files 1 "number": 7, "baseBranchName": "main", "headBranchName": "feature-branch-plain-merge", + "mergeCommitOid": "b29149f890e6f76ee31ed128585744d4c598924c", "title": "feat: feature that will be plain merged", "body": "", "labels": [], diff --git a/src/github.ts b/src/github.ts index 0b581b646..f36a98f15 100644 --- a/src/github.ts +++ b/src/github.ts @@ -510,6 +510,7 @@ export class GitHub { number: pullRequest.number, baseBranchName: pullRequest.baseRefName, headBranchName: pullRequest.headRefName, + mergeCommitOid: pullRequest.mergeCommit?.oid, title: pullRequest.title, body: pullRequest.body, labels: pullRequest.labels.nodes.map(node => node.name), diff --git a/src/manifest.ts b/src/manifest.ts index 5226ac21f..281e20ee7 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -1575,7 +1575,7 @@ async function latestReleaseVersion( for await (const commitWithPullRequest of generator) { commitShas.add(commitWithPullRequest.sha); const mergedPullRequest = commitWithPullRequest.pullRequest; - if (!mergedPullRequest) { + if (!mergedPullRequest?.mergeCommitOid) { logger.trace( `skipping commit: ${commitWithPullRequest.sha} missing merged pull request` ); diff --git a/src/pull-request.ts b/src/pull-request.ts index a44feaee1..9176207d4 100644 --- a/src/pull-request.ts +++ b/src/pull-request.ts @@ -16,6 +16,7 @@ export interface PullRequest { readonly headBranchName: string; readonly baseBranchName: string; readonly number: number; + readonly mergeCommitOid?: string; readonly title: string; readonly body: string; readonly labels: string[]; diff --git a/test/manifest.ts b/test/manifest.ts index 7315dee0c..cbf259f02 100644 --- a/test/manifest.ts +++ b/test/manifest.ts @@ -1423,6 +1423,7 @@ describe('Manifest', () => { title: 'chore: release 1.2.3', headBranchName: 'release-please/branches/main', baseBranchName: 'main', + mergeCommitOid: 'abc123', number: 123, body: '', labels: [],