Skip to content

Commit 60cf4b8

Browse files
committed
[TASK] Shorten filter function
1 parent 2f931d9 commit 60cf4b8

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

dist/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,8 @@ function getCommitMessagesFromPullRequest(accessToken, repositoryOwner, reposito
376376
if (repository.pullRequest) {
377377
messages = repository.pullRequest.commits.edges
378378
.filter(function (edge) {
379-
if (edge.node.commit.parents.totalCount > 1) {
380-
// Skip merge commits (which have more than 1 parent commit)
381-
return false;
382-
}
383-
return true;
379+
// Skip merge commits (which have more than 1 parent commit)
380+
return edge.node.commit.parents.totalCount === 1;
384381
})
385382
.map(function (edge) {
386383
return edge.node.commit.message;

src/input-helper.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,8 @@ async function getCommitMessagesFromPullRequest(
301301
if (repository.pullRequest) {
302302
messages = repository.pullRequest.commits.edges
303303
.filter(function (edge: CommitEdgeItem): boolean {
304-
if (edge.node.commit.parents.totalCount > 1) {
305-
// Skip merge commits (which have more than 1 parent commit)
306-
return false
307-
}
308-
return true
304+
// Skip merge commits (which have more than 1 parent commit)
305+
return edge.node.commit.parents.totalCount === 1
309306
})
310307
.map(function (edge: CommitEdgeItem): string {
311308
return edge.node.commit.message

0 commit comments

Comments
 (0)