Skip to content

Commit

Permalink
Some bug fixes for the iterate on an issue DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Jun 9, 2018
1 parent 79d1881 commit eb0fc73
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

## Master

# 3.7.16

* More work on `danger.github.utils.createUpdatedIssueWithID`. - [@orta][]

# 3.7.15

* Turns on the strict mode in the typescript compiler, this only gave build errors, so I was basically there anyway.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "danger",
"version": "3.7.15",
"version": "3.7.16",
"description": "Unit tests for Team Culture",
"main": "distribution/danger.js",
"typings": "distribution/danger.d.ts",
Expand Down
7 changes: 4 additions & 3 deletions source/platforms/github/GitHubUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export const createUpdatedIssueWithIDGenerator = (api: GitHub) => async (
// Could also scope:
// by author
// by label
// by repo
const uniqueHeader = `Danger-ID: ${id.replace(/ /g, "_")}`
const { data: searchResults } = await api.search.issues({ q: uniqueHeader })
const uniqueHeader = `Danger-Issue-ID-${id.replace(/ /g, "_")}`
const q = `user:${settings.owner} repo:${settings.repo} ${uniqueHeader}`
const { data: searchResults } = await api.search.issues({ q })
d(`Got ${searchResults.total_count} for ${uniqueHeader}`)

const body = `${content}\n\n${uniqueHeader}`
Expand All @@ -87,6 +87,7 @@ export const createUpdatedIssueWithIDGenerator = (api: GitHub) => async (

if (searchResults.total_count > 0 && searchResults.items[0]) {
const issueToUpdate = searchResults.items[0]
d(`Found: ${issueToUpdate}`)
const { data: issue } = await api.issues.edit({ body, owner, repo, title, number: issueToUpdate.number, state })
return issue.html_url
} else {
Expand Down
2 changes: 1 addition & 1 deletion source/runner/runners/inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const runDangerfileEnvironment = async (
// without the scheduler
await runAllScheduledTasks(environment.results)
} catch (error) {
console.error("Unable to evaluate the Dangerfile\n", error)
console.log("Unable to evaluate the Dangerfile\n", error)
d("Got a parse error: ", error)

// Call the internal functions to fail the build
Expand Down

0 comments on commit eb0fc73

Please sign in to comment.