Skip to content

Commit e01cf05

Browse files
author
Benjamin E. Coe
authored
fix: logic was throwing out merge commits (googleapis#649)
1 parent 80cd63c commit e01cf05

3 files changed

Lines changed: 8 additions & 17 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
"homepage": "https://github.com/googleapis/release-please#readme",
3939
"devDependencies": {
40-
"@octokit/types": "^6.0.0",
40+
"@octokit/types": "^6.1.0",
4141
"@types/chai": "^4.1.7",
4242
"@types/mocha": "^8.0.0",
4343
"@types/node": "^11.13.6",

src/github.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,9 @@ export class GitHub {
559559
labels.length === 0 ||
560560
this.hasAllLabels(
561561
labels,
562-
pull.labels.map(l => l.name)
562+
pull.labels.map(l => {
563+
return l.name + '';
564+
})
563565
)
564566
) {
565567
// it's expected that a release PR will have a
@@ -683,7 +685,7 @@ export class GitHub {
683685
})
684686
)) {
685687
for (let i = 0; response.data[i] !== undefined; i++) {
686-
const issue = response.data[i] as IssuesListResponseItem;
688+
const issue = response.data[i] as {title: string; state: string};
687689
if (issue.title.indexOf(title) !== -1 && issue.state === 'open') {
688690
return issue;
689691
}
@@ -833,8 +835,8 @@ export class GitHub {
833835
Authorization: `${this.proxyKey ? '' : 'token '}${this.token}`,
834836
},
835837
});
836-
this.defaultBranch = data.default_branch;
837-
return this.defaultBranch;
838+
this.defaultBranch = (data as {default_branch: string}).default_branch;
839+
return this.defaultBranch as string;
838840
}
839841

840842
async closePR(prNumber: number) {

src/graphql-to-commits.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,7 @@ async function graphqlToCommit(
126126

127127
let prEdge: PREdge = commitEdge.node.associatedPullRequests.edges[0];
128128

129-
// if the commit.sha and mergeCommit.oid do not match, assume that this
130-
// was a push directly to the default branch.
131-
//
132-
// TODO: investigate our motivations for skipping commits when
133-
// commitEdge.node.oid and prEdge.node.mergeCommit.oid do not match (this
134-
// caused issues for the legitimate use-case of merge commits.
135-
if (
136-
!commit.sha ||
137-
!prEdge.node.mergeCommit ||
138-
(commit.sha !== prEdge.node.mergeCommit.oid &&
139-
!observedSHAs.has(prEdge.node.mergeCommit.oid))
140-
) {
129+
if (!commit.sha) {
141130
return undefined;
142131
}
143132
observedSHAs.add(commit.sha);

0 commit comments

Comments
 (0)