Skip to content

Commit

Permalink
Switch to lodash find to fix #181
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Mar 21, 2017
1 parent 0993716 commit 7863fa4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

* Improves messaging to the terminal - orta
* Adds the ability to not have Danger post to GitHub via a flag: `danger run --text-only` - orta
* Fix a crasher with `prs.find` #181 - orta

### 0.13.0

Expand Down
3 changes: 2 additions & 1 deletion source/ci_source/ci_source_helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Env, CISource } from "./ci_source"
import { GitHubAPI } from "../platforms/github/GitHubAPI"
import { GitHubPRDSL } from "../dsl/GitHubDSL"
import * as find from "lodash.find"

/**
* Validates that all ENV keys exist and have a length
Expand Down Expand Up @@ -48,7 +49,7 @@ export async function getPullRequestIDForBranch(source: CISource, env: Env, bran
}
const api = new GitHubAPI(source, token)
const prs = await api.getPullRequests() as any[]
const prForBranch: GitHubPRDSL = prs.find((pr: GitHubPRDSL) => pr.head.ref === branch)
const prForBranch: GitHubPRDSL = find(prs, (pr: GitHubPRDSL) => pr.head.ref === branch)
if (prForBranch) {
return prForBranch.number
}
Expand Down

0 comments on commit 7863fa4

Please sign in to comment.