Skip to content

Commit

Permalink
Merge pull request #585 from mxstbr/fix-previous-comments-bug
Browse files Browse the repository at this point in the history
Fix previousComments error
  • Loading branch information
orta committed May 2, 2018
2 parents 8d76df7 + 2dc959f commit 485e4bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

## Master

* Fix running Danger on issues with no comments [@mxstbr][]

# 3.6.2

* Automatically rate limit concurrent GitHub API calls to avoid hitting GitHub rate limits [@mxstbr][]
Expand Down
4 changes: 2 additions & 2 deletions source/runner/Executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class Executor {
*
* @param results Results with inline violations
*/
sendInlineComments(results: DangerResults, git: GitDSL, previousComments: Comment[]): Promise<DangerResults> {
sendInlineComments(results: DangerResults, git: GitDSL, previousComments: Comment[] | null): Promise<DangerResults> {
if (!this.platform.supportsInlineComments) {
return new Promise(resolve => resolve(results))
}
Expand All @@ -295,7 +295,7 @@ export class Executor {
// if there is - update it and remove comment from deleteComments array (comments prepared for deletion)
// if there isn't - create a new comment
// Leftovers in deleteComments array should all be deleted afterwards
let deleteComments = previousComments.filter(c => c.ownedByDanger)
let deleteComments = previousComments ? previousComments.filter(c => c.ownedByDanger) : []
let commentPromises: Promise<any>[] = []
for (let inlineResult of sortedInlineResults) {
const index = deleteComments.findIndex(p =>
Expand Down

0 comments on commit 485e4bd

Please sign in to comment.