UNPKG

62.7 kBMarkdownView Raw
1<!--
2
3// Please add your own contribution below inside the Master section, no need to
4// set a version number, that happens during a deploy. Thanks!
5//
6// These docs are aimed at users rather than danger developers, so please limit technical
7// terminology in here.
8
9// Note: if this is your first PR, you'll need to add your URL to the footnotes
10// see the bottom of this file. The list there is sorted, try to follow that.
11x
12-->
13
14## Master
15
16<!-- Your comment below this -->
17
18<!-- Your comment above this -->
19
20# 9.2.7
21
22- Maybe fix deploys to GPR for Docker - [@orta]
23
24# 9.2.6
25
26- Add support for Cirrus CI - [@RDIL]
27
28# 9.2.5
29
30- Remove additional danger from pr generated json - [@f-meloni]
31
32# 9.2.4
33
34- Fix github actions checks - [@f-meloni]
35
36# 9.2.3
37
38- Support more events on GitHub actions - [@f-meloni]
39
40# 9.2.2
41
42- Fix binary files for BitBucket Server - [@osmestad]
43- Allow GHE to use checks - [@adam-bratin]
44
45# 9.2.1
46
47- Fix structuredDiffForFile for BitBucket Server - [@osmestad]
48- Fix Buddy.works isPR and use PR number instead of PR ID - [@mmiszy]
49- remove jsome package and replace with prettyjson - [@watchinharrison]
50- Add GitLab support to Jenkins provider - [@sandratatarevicova]
51
52# 9.2.0
53
54- Add Buddy.works Pipelines support - [@kristof0425]
55- Added flag to bypass Jira/Issues - [@orieken]
56- Improve docs for GitHub Actions - [@nguyenhuy]
57
58# 9.1.8
59
60- Get GitHub Actions event file pathname from env variable - [@IljaDaderko]
61
62# 9.1.7
63
64- GitHub Actions docs update - [@orta]
65
66# 9.1.6
67
68- Release only made for GitHub Actions - [@orta]
69
70# 9.1.5
71
72- Take commit hash from bitrise env - [@f-meloni]
73
74# 9.1.4
75
76- Use new env `BITBUCKET_REPO_FULL_NAME` in bitbucket pipeline. - [@Soyn]
77- Take commit hash from CI Source if available - [@f-meloni]
78
79# 9.1.3
80
81- Updates GitLab API to 10.x - [@awgeorge]
82
83# 9.1.2
84
85- Add retry handling for API requests - [@jtreanor]
86
87# 9.1.1
88
89- Fixes TS declarations - [@orta]
90- Fix Github Actions documentation - [@ravanscafi]
91- Improve Performance by Caching BitBucket Cloud Commits - [@hellocore]
92- Add compliment message to comment template on Bitbucket Cloud - [@hellocore]
93- Add option to set custom icon in messages - [@rohit-smpx]
94
95# 9.1.0
96
97- Expose BitBucketServerAPI - [@NMinhNguyen]
98
99# 9.0.3
100
101- Add support OAuth for BitBucket Cloud - [@hellocore]
102- Allow `handleResults` to be called without a `git` object - [@jtreanor]
103
104# 9.0.2
105
106- Fix for the GitLab dependency making danger not load - [@f-meloni]
107
108# 9.0.1
109
110- Fixed incorrect main comment template on Bitbucket Cloud - [@hellocore]
111
112# 9.0.0
113
114- Add BitBucket Cloud & BitBucket Pipelines support - [@hellocore]
115- Add GitLab missing states - [@f-meloni]
116- Fixes incorrect slug for builds from forks on Codefresh - [@stevenp]
117
118# 8.0.0
119
120- Adds GitLab & GitLab CI support - [@notjosh], [@bigkraig], [@jamime]
121- Add support for AppCenter - [@mrndjo]
122
123# 7.1.4
124
125- Un-hardcodes the repo in `danger.github.utils.createOrUpdatePR`- [@ds300]
126
127# 7.1.3
128
129- Cleans up the declarations a little bit - [@orta]
130- Adds support for [Codefresh CI](https://codefresh.io) - [@stevenp]
131
132# 7.1.2
133
134- Update ts-jest to 24.0.2 - [@friederbluemle]
135- Adds a fix for the default name of Danger in status - [@orta]
136- Adds `danger.git.fileMatch.getKeyedPaths()`, providing more convenient access to paths. This replaces
137 `fileMatch.tap()` and `fileMatch.debug()`.
138
139 ```ts
140 const components = fileMatch("components/**/*.js", "!**/*.test.js")
141 const componentTests = fileMatch("!**/*.test.js")
142
143 if (components.edited && !componentTests.edited) {
144 warn(
145 [
146 "This PR modified some components but none of their tests. <br>",
147 "That's okay so long as it's refactoring existing code. <br>",
148 "Affected files: ",
149 components.getKeyedPaths().edited.join(", "),
150 ].join("")
151 )
152 }
153 ```
154
155 This makes it much simpler to compose a collection of file checks - [@paulmelnikow]
156
157# 7.1.0
158
159- Adds Chainsmoker, and expands the Danger DSL with the addition of `danger.git.fileMatch`.
160
161 ```ts
162 const documentation = danger.git.fileMatch("**/*.md")
163 const packageJson = danger.git.fileMatch("package.json")
164 const lockfile = danger.git.fileMatch("yarn.lock", "package-lock.json")
165
166 if (documentation.edited) {
167 message("Thanks - We :heart: our [documentarians](http://www.writethedocs.org/)!")
168 }
169
170 if (packageJson.modified && !lockfile.modified) {
171 warn("This PR modified package.json, but not the lockfile")
172 }
173 ```
174
175 This makes it much simpler to compose a collection of file checks - [@paulmelnikow]
176
177# 7.0.19
178
179- Taken a stab at trying to make the commit status summary to feel better in both Danger & Peril [@orta][@dblandin]
180
181# 7.0.18
182
183- Adds a CLI option `--failOnErrors` so that you can force `danger ci` to return a failed exit code on any `fail`s in a
184 Dangerfile [@f-meloni]
185
186# 7.0.17
187
188- Send different build update keys based on the id on Bitbucket [@f-meloni]
189
190# 7.0.16
191
192- Add support for CodeBuild CI source [@sharkysharks]
193
194# 7.0.15
195
196- Enable Danger runs with different DangerIDs to post separate statuses [@randak]
197- Docs: fix typo - [@hiroppy]
198- Fixed: isCI check for Codeship - [@msteward]
199
200# 7.0.14
201
202- Fixed: Crash on BitbucketServer when the change type is unknown - [@f-meloni]
203- Add `linesOfCode` in `GitDSL` - [@ninjaprox]
204- Docs: document GitHubMergeRef type - [@nornagon]
205
206# 7.0.13
207
208- Adds some Debug logs for babel transformation - [@orta]
209
210# 7.0.12
211
212- Support multi-line import/require statements in Dangerfiles & possibly fix source-mapping for errors - [@fbartho]
213
214# 7.0.11
215
216- Return the DangerResults meta after sorting and merging operations - [@f-meloni]
217- Make bitbucket generated signature less aggressive - [@f-meloni]
218
219# 7.0.9
220
221- Updates the import for octokit at the top of the danger.d.ts - [@orta]
222
223# 7.0.8
224
225- Handles the previews API correctly - [@orta]
226
227# 7.0.7
228
229- Removed `vm2` from Danger, it's not being used in Peril now - [@orta]
230- `danger pr` with `--json` or --js` now don't require a Dangerfile to be present - [@orta]
231
232# 7.0.5
233
234- Remove dead links to example danger files. - [@stevemoser]
235- Allow danger-pr to work also on Bitbucket Server - [@f-meloni]
236- Fix for nulls in modified_files - [@orta]
237- Use new APIs in OctoKit - [@orta]
238
239# 7.0.4
240
241- More fixes for `GITHUB_URL` instead of just `DANGER_GITHUB_URL` for GitHub Enterprise. - [@Aghassi]
242
243# 7.0.3
244
245- Lets you use `GITHUB_URL` instead of just `DANGER_GITHUB_URL` for GitHub Enterprise. - [@Aghassi]
246
247# 7.0.2
248
249- Fix issue where the PR command could not be run with a GitHub Enterprise URL.
250- Specify filename when loading Babel options. Fixes [#664](https://github.com/danger/danger-js/issues/664)
251 ([#804](https://github.com/danger/danger-js/pull/804)) - [@NMinhNguyen]
252- Running Danger on GitHub Actions now runs Danger from source code. Before that, Danger on GitHub Actions is stuck at
253 v5.0.0-beta-24. [@dtinth](https://github.com/danger/danger-js/pull/810)
254
255# 7.0.1
256
257- Make use of GitHub Checks optional and disabled by default, pass `--use-github-checks` to enable.
258 [@cysp](https://github.com/danger/danger-js/pull/798)
259
260# 7.0.0
261
262- Updates `@octokit/rest` to v16.x.x - this is a **major** semver change on their end, which I know it breaks some of
263 Artsy/Danger's Peril Dangerfiles, so it's possible that it could break your Dangerfiles too. How do you know?
264
265 Roughly, if you have any code that uses `danger.github.api` then it's very possible that you need to update your code.
266
267 There are update notes [here](https://github.com/octokit/rest.js/releases/tag/v16.0.1), but if you're using TypeScript
268 then it'll raise the issues at a type-check level. Note, that this version may cause issues if you are using GitHub
269 Enterprise, you can get [updates here](https://github.com/danger/danger-js/issues/797).
270
271# 6.1.13
272
273- Allow sub-processes to pass their own name an href so that it doesn't say made by Danger JS [@orta]
274
275 This is done by extending the `DangerResults` object passed back to Danger JS, by adding a meta section to the JSON:
276
277 ```json
278 {
279 "markdowns": [],
280 "fails": [],
281 "warnings": [],
282 "messages": [],
283 "meta": {
284 "runtimeHref": "https://mysite.com",
285 "runtimeName": "My Danger Runner"
286 }
287 }
288 ```
289
290 `"meta"` is optional, and will fall back to the DangerJS one.
291
292- Removed a dependency (voca) now that we're using TypeScript and have access to .includes [@orta]
293
294# 6.1.12
295
296- Fix issue with detecting Babel if `babel-core` is installed - [@sajjadzamani]
297
298# 6.2.0
299
300- Fix detection of GitHub Actions event types [@cysp]
301
302# 6.1.9
303
304- Add commit ID to the comment footer [danger/danger-js#168] - [@randak]
305- Add support for `COPY` change type to fix a BitBucket Server regression in
306 [danger/danger-js#764](https://github.com/danger/danger-js/pull/764) - [@sebinsua]
307- Add support for older Babel versions (prior 7) [@sajjadzamani]
308
309# 6.1.8
310
311- Revert removal of implicit `<p>` tag from [danger/danger-js#754](https://github.com/danger/danger-js/pull/754) and add
312 distinction depending on containing markdown or not - [@hanneskaeufler]
313
314# 6.1.7
315
316- Update comment instead deleting, if it has replies (BitBucket Server) [@langovoi]
317- Fix BitBucket Server GitDSL [@langovoi]
318- Add support of paged APIs of BitBucket Server [@langovoi]
319
320# 6.1.6
321
322- Adds a CLI flag for custom Danger Runners to be able to request a URL to a JSON file instead of receiving the entire
323 DSL as a big JSON dump. We're exploring using this in Danger Swift with
324 [danger/swift#108](https://github.com/danger/swift/issues/108) - [@orta]
325
326# 6.1.5
327
328- Adds `html_url` to the PR JSON declaration - [@orta]
329- Adds a way for a sub-process to tell danger-js that it wants a copy of the DSL. This is a potential fix for when you
330 have a process that might not be ready to grab the DSL instantly from danger-js. The subprocess can print the message
331 `danger://send-dsl` to stdout and danger-js will re-send the DSL via STDIN.
332 [danger/swift#108](https://github.com/danger/swift/issues/108). - [@orta]
333- Allows a FakeCI to get a FakePlatform, should fix [#767](https://github.com/danger/danger-js/issues/767) - [@orta]
334
335# 6.1.4
336
337- Fix `GitJSONDSL` and `diffForFile` for BitBucket Server - [@langovoi]
338
339# 6.1.3
340
341- Add support for personal tokens of BitBucket Server - [@langovoi]
342- Ships a command `danger-js` which means other languages could also use the command danger and they won't conflict with
343 the JS version - [@orta]
344
345# 6.1.2
346
347- Checks for the JSON results file reported by a subprocess before accessing it - [@orta]
348
349# 6.1.1
350
351- Improves debug logging, messaging on CI about status updates - [@orta]
352- Better detection of json results: {} from a sub-process - [@orta]
353- CLI Args are actually passed to subprocess instead of an empty object - [@orta]
354- Fix Netlify integration when repo url includes an access token - [@imorente]
355
356# 6.1.0
357
358- Add CI integration for Netlify - [@imorente]
359
360# 6.0.7
361
362- Removes an accidental import - [@orta]
363
364# 6.0.6
365
366- Adds an internal flag for disabling checks support when being controller by Peril - [@orta]
367
368# 6.0.5
369
370- Fix `danger pr` - [@orta]
371
372# 6.0.4
373
374- Fix GitHub checks API payload - [@pveyes]
375
376# 6.0.3
377
378- Fix passing stdout from the sub-process back to the user - [@orta]
379- Fix handling a `"pending"` status update properly using Bitbucket API - [@sgtcoolguy]
380- Fix #614 - Posting status updates to Github using issue workflow broken - [@sgtcoolguy]
381- Fix vertical alignment in GitHub issue template - [@patrickkempff]
382
383# 5.0.1, err. 6.0.0
384
385- Hah, my computer ran out opf power mid-deploy, and now I have to ship another build to make sure the brew versions of
386 Danger JS are set up correctly. - orta
387
388- Hah, I managed to run the same 'deploy major' command instead. So... Happy v6! - orta
389
390# 5.0.0
391
392_No breaking changes_ - I'm just bumping it because it's a lot of under-the-hood work, and I've not been able to test it
393thoroughly in production.
394
395This release bring support for GitHub actions. It does this merging in some of the responsibilities that used to live
396inside Peril into Danger.
397
398Notes about Danger JS:
399
400- Adds support for running remote GitHub files via the `--dangerfile` argument. It supports urls like:
401 `orta/peril-settings/file.ts` which grabs `file.ts` from `orta/peril-settings`.
402- Adds support for taking a GitHub Actions event JSON and exposing it in the `default export` function in the same way
403 that Peril does it.
404- Adds a GitHubActions CI provider - it declares that it can skip the PR DSL so that Danger can also run against
405 issues/other events
406- Handle remote transpilation of the initial Dangerfile correctly
407- Adds support for not include a tsconfig for typescript projects, danger will use the default config if it can't find
408 one in your project
409- Hardcodes the GitHub Actions userID into danger ( blocked by
410 https://platform.github.community/t/obtaining-the-id-of-the-bot-user/2076 )
411- Allows running with a simplified DSL when running on a GitHub action that isn't a PR
412- Use new env vars for GitHub Actions
413
414There is now 2 ways for a subprocess to communicate to Danger JS - prior to 5.x it was expected that a subprocess would
415pass the entire JSON results back via STDOUT to the host Danger JS process, but sometimes this was unreliable. Now a
416subprocess can pass a JSON URL for Danger JS by looking in STDOUT for the regex `/danger-results:\/\/*.+json/`.
417
418There is now a JSON schema for both directions of the communication for sub-processes:
419
420- The data Danger sends to the subprocess:
421 [`source/danger-incoming-process-schema.json`](source/danger-incoming-process-schema.json)
422- The data Danger expects from the subprocess:
423 [`source/danger-outgoing-process-schema.json`](source/danger-outgoing-process-schema.json)
424
425This can be used for language DSL generation and/or formal verification if you're interested. Or, for just feeling
426completely sure about what is being sent to your process without diving into the Danger JS codebase.
427
428Also, `danger pr` now accepts a `--process` arg.
429
430# 4.4.9
431
432- Add logic for "DANGER_DISABLE_TRANSPILATION" env [@markelog]
433- Jenkins: Respect `CHANGE_URL`/`CHANGE_ID` for GitHub and BitBucket Server [@azz]
434- Docs: Guides - Update link to apollo-client dangerfile.ts example [@andykenward]
435- Fix crash that may occur when no message is set on generic event [@flovilmart]
436- Add support to proxy requests using `HTTP_PROXY` or `HTTPS_PROXY` environment variables [@steprescott]
437
438# 4.4.0-7
439
440- Supports installation using Homebrew [@thii]
441
442# 4.3.x
443
444- Some experimental beta builds which didn't turn out very useful
445
446# 4.2.1
447
448- Adds a fallback to `GITHUB_TOKEN` if it's in the ENV - orta
449- There was some versioning faffing going on
450
451# 4.1.0
452
453- Adds the ability to send a PR from a Dangerfile easily.
454
455 ```ts
456 import { danger } from "danger"
457
458 export default async () => {
459 // This is a map of file to contents for things to change in the PR
460 const welcomePR = {
461 LICENSE: "[the MIT license]",
462 "README.md": "[The README content]",
463 }
464
465 // Creates a new branch called `welcome`, from `master`. Creates a commit with
466 // the changes above and the message "Sets up ...". Then sends a PR to `orta/new-repo`
467 // with the title "Welcome to ..." and the body "Here is ...".
468 await danger.github.utils.createOrUpdatePR(
469 {
470 title: "Welcome to [org]",
471 body: "Here is your new repo template files",
472 owner: "orta",
473 repo: "new-repo",
474 baseBranch: "master",
475 newBranchName: "welcome",
476 commitMessage: "Sets up the welcome package",
477 },
478 welcomePR
479 )
480 }
481 ```
482
483 OK, so this one is cool. This function will create/update an existing PR. You pass in a config object that defines;
484 the commit, the branch and the PR metadata and then this function will go and set all that up for you.
485
486 The second argument is a fileMap, this is an object like `{ "README.md": "[the content]" }` and it defines what files
487 should change in the commit. The files are completely changed to the content in the fileMap, so if you're making a
488 single line change - you need to submit the enfile file.
489
490 This is all based on my module
491 [memfs-or-file-map-to-github-branch](https://www.npmjs.com/package/memfs-or-file-map-to-github-branch) so if you need
492 a set of lower level APIs for PR/branch needs, `import` that and use it. - [@orta]
493
494# 4.0.1
495
496- Fixed a bug where Danger would fail to update status when there are no failures or messages [@johansteffner]
497- Fixed a bug where Danger was throwing an error when removing any existing messages [@stefanbuck]
498
499# 4.0.0
500
501- Updates Danger's runtime to work with Babel 7 - [@adamnoakes]
502
503 **Breaking:** 3.9.0 was the last version to support inline transpilation via Babel 6. Danger doesn't specify babel in
504 its dependencies, so this warning won't show anywhere else.
505
506# 3.9.0
507
508- Adds CI integration for Concourse - [@cwright017]
509
510# 3.8.9
511
512- Adds debug logs to the vm2 runner used in Peril - [@orta]
513
514# 3.8.5 - 3.8.8
515
516- Adds a function to handle creating or adding a label on a PR/Issue. Works with both Danger and Peril:
517 `danger.github.createOrAddLabel` - [@orta]
518
519# 3.8.4
520
521- Exposes some internals on module resolution to Peril - [@orta]
522
523# 3.8.3
524
525- Fix bitbucket error when trying to obtain a response json when the response code is 204 (which means that there is no
526 response).
527- Fix bitbucket link of the PR status, so it opens the web version of the PR, pointing to the Danger comment
528 [646](https://github.com/danger/danger-js/pull/646) - [@acecilia](https://github.com/acecilia)
529- Adapt emoji for Bitbucket server to fix "Database error has occurred"
530 [645](https://github.com/danger/danger-js/pull/645) - [@acecilia](https://github.com/acecilia)
531
532# 3.8.2
533
534- Use the Peril Bot ID for the comment lookup checks - [@orta]
535
536# 3.8.1
537
538- Adds additional logging to handleResultsPostingToPlatform - [@ashfurrow]
539
540# 3.8.0
541
542- Fixes a crash if lodash isn't a transitive dependency in your node_modules - [@orta]
543- Using the Checks API will now post a summary comment on a PR - [@orta]
544
545# 3.7.20
546
547- Logging / verification improvements for the subprocess - [@orta]
548
549# 3.7.19
550
551- Convert the `exec` in `danger local` to a `spawn` hopefully unblocking large diffs from going through it -
552 [@joshacheson][@orta]
553
554# 3.7.18
555
556- Report the error in a commit status update when in verbose - [@orta]
557
558# 3.7.17
559
560- Improvements to PR detection on Team City - @markelog
561
562# 3.7.16
563
564- More work on `danger.github.utils.createUpdatedIssueWithID`. - [@orta]
565
566# 3.7.15
567
568- Turns on the strict mode in the typescript compiler, this only gave build errors, so I was basically there anyway.
569 This is so that the type defs will always pass inside environments where strict is already enabled. - [@orta]
570
571- Updates to TypeScript 2.9. - [@orta]
572
573# 3.7.14
574
575- Minor refactoring in GitHubUtils to allow Peril to re-create some of the util functions - [@orta]
576
577# 3.7.13
578
579- Updates type declarations to use top-level exports instead of a module augmentation - [@DanielRosenwasser]
580- Bug fixes for `danger.github.utils.createUpdatedIssueWithID` - [@orta]
581
582# 3.7.2-12
583
584- Improved debugging when using the GitHub OctoKit - [@orta]
585- Added `danger.github.utils.createUpdatedIssueWithID` which can be used to have danger continually update a single
586 issue in a repo, for example:
587
588 ```ts
589 await danger.github.utils.createUpdatedIssueWithID("TestID", "Hello World", {
590 title: "My First Issue",
591 open: true,
592 repo: "sandbox",
593 owner: "PerilTest",
594 })
595 ```
596
597 Will first create, then update that issue with a new body. - [@orta]
598
599# 3.7.1
600
601- Improve checks support for Danger - orta
602
603# 3.7.0
604
605- Adds support for the GH Checks API.
606
607 This brings some interesting architectural changes inside Danger, but more important to you dear reader, is that using
608 the Checks API has some API restrictions. This makes in infeasible to re-use the user access token which we've
609 previously been recommending for setup.
610
611 Instead there are two options:
612
613 - Use a GitHub app owned by Danger: https://github.com/apps/danger-js
614 - Use your own GitHub app.
615
616 The security model of the GitHub app means it's totally safe to use our GitHub app, it can only read/write to checks
617 and has no access to code or organizational data. It's arguably safer than the previous issue-based comment.
618
619 To use it, you need to hit the above link, install the app on the org of your choice and then get the install ID from
620 the URL you're redirected to. Set that in your CI's ENV to be `DANGER_JS_APP_INSTALL_ID` and you're good to go.
621
622 If you want to run your own GitHub App, you'll need to set up a few ENV vars instead:
623
624 - `DANGER_GITHUB_APP_ID` - The app id, you can get this from your app's overview page at the bottom
625 - `DANGER_GITHUB_APP_PRIVATE_SIGNING_KEY` - The whole of the private key as a string with `\n` instead of newlines
626 - `DANGER_GITHUB_APP_INSTALL_ID` - The installation id after you've installed your app on an org
627
628 Checks support is still a bit of a WIP, because it's a whole new type of thing. I don't forsee a need for Danger to be
629 deprecating the issue based commenting (we use that same infra with bitbucket).
630
631 So now there are three ways to set up communications with GitHub, I'm not looking forwards to documenting that.
632
633 [@orta]
634
635- JSON diffs use the JSON5 parser, so can now ignore comments in JSON etc [@orta]
636- Allows the synchronous execution of multiple dangerfiles in one single "danger run".
637
638 Not a particularly useful feature for Danger-JS, but it means Peril can combine many runs into a single execution
639 unit. This means people only get 1 message. [@orta]
640
641# 3.6.6
642
643- Updates vm2 to be an npm published version [@orta]
644
645# 3.6.5
646
647- Fix setting the status url on bitbucket [@orta]
648- Adds more logs to `danger process` [@orta]
649
650# 3.6.4
651
652- Fix running Danger on issues with no comments for real [@mxstbr]
653
654# 3.6.3
655
656- Fix running Danger on issues with no comments [@mxstbr]
657
658# 3.6.2
659
660- Automatically rate limit concurrent GitHub API calls to avoid hitting GitHub rate limits [@mxstbr]
661
662# 3.6.1
663
664- Catch the github api error thrown from @octokit/rest [@Teamop]
665- Replace preview media type of github pull request reviews api [@Teamop]
666- Add support for [Screwdriver CI](http://screwdriver.cd) [@dbgrandi]
667
668# 3.6.0
669
670- A Dangerfile can return a default export, and then Danger will handle the execution of that code [@orta]
671- Changes the order of the text output in verbose, or when STDOUT is the only option [@orta]
672- Prints a link to the comment in the build log [@orta]
673
674## 3.5.0 - 3.5.1
675
676- Fixed a bug where Danger posts empty main comment when it have one or more inline comments to post [@codestergit]
677- fix bug when commiting .png files on BitBucket [@Mifi]
678- Adds support for inline comments for bitbucket server. [@codestergit]
679
680## 3.4.7
681
682- Update dependencies [@orta]
683
684## 3.4.6
685
686- Fixed Babel 7 breaking due to invalid sourceFileName configuration [@kesne]
687
688## 3.4.5
689
690- Don't print error for commit status when there was no error [@sunshinejr]
691
692## 3.4.4
693
694- Fixed a bug where Danger would get access to _all_ inline comments, thus deleting comments posted by other people
695 [@sunshinejr]
696
697## 3.4.3
698
699- Fixed a bug where updating multiple inline comments caused a Javascript error [@sunshinejr]
700
701## 3.4.2
702
703- Improving reporting when multiple violations are o nthe same line of a file [@sunshinejr]
704
705## 3.4.1
706
707- Protection against nulls in the inline comment data [@orta]
708
709## 3.4.0
710
711- Adds support for inline comments when using GitHub.
712
713 This is one of those "massive under the hood" changes, that has a tiny user DSL surface. From this point onwards
714 `fail`, `warn`, `message` and `markdown` all take an extra two optional params: `file?: string` and `line?: number`.
715
716 Adding `file` and `line` to the call of any exported communication function will trigger one of two things:
717
718 - Danger will create a new comment inline inside your PR with your warning/message/fail/markdown
719 - Danger will append a in the main Danger comment with your warning/message/fail/markdown
720
721 Inline messages are edited/created/deleted with each subsequent run of `danger ci` in the same way the main comment
722 does. This is really useful for: linters, test runners and basically anything that relies on the contents of a file
723 itself.
724
725 If you're using `danger process` to communicate with an external process, you can return JSON like:
726
727 ```json
728 {
729 "markdowns": [
730 {
731 "file": "package.swift",
732 "line": 3,
733 "message": "Needs more base"
734 }
735 ]
736 // [...]
737 }
738 ```
739
740 -- [@sunshinejr]
741
742- Adds a data validation step when Danger gets results back from a process . [@orta]
743
744## 3.3.2
745
746- Adds support for TeamCity as a CI provider. [@fwal]
747
748## 3.3.1
749
750- Fixed Babel 7 breaking because of sourceFileName being defined wrong. [@happylinks]
751
752## 3.3.0
753
754- Fix `committer` field issue - missing in Stash API by using commit author instead. [@zdenektopic]
755- Adds a new command: `reset-status`
756
757 This command is for setting the CI build status in advance of running Danger. If your Danger build relies on running
758 tests/linters, then you might want to set the PR status (the red/green/yellow dots) to pending at the start of your
759 build. You can do this by running `yarn danger reset-status`.
760
761 [@mxstbr]
762
763## 3.2.0
764
765- Add BitBucket Server support.
766
767 To use Danger JS with BitBucket Server: you'll need to create a new account for Danger to use, then set the following
768 environment variables on your CI:
769
770 - `DANGER_BITBUCKETSERVER_HOST` = The root URL for your server, e.g. `https://bitbucket.mycompany.com`.
771 - `DANGER_BITBUCKETSERVER_USERNAME` = The username for the account used to comment.
772 - `DANGER_BITBUCKETSERVER_PASSWORD` = The password for the account used to comment.
773
774 Then you will have a fully fleshed out `danger.bitbucket_server` object in your Dangerfile to work with, for example:
775
776 ```ts
777 import { danger, warn } from "danger"
778
779 if (danger.bitbucket_server.pr.title.includes("WIP")) {
780 warn("PR is considered WIP")
781 }
782 ```
783
784 The DSL is fully fleshed out, you can see all the details inside the [Danger JS Reference][ref], but the summary is:
785
786 ```ts
787 danger.bitbucket_server.
788 /** The pull request and repository metadata */
789 metadata: RepoMetaData
790 /** The related JIRA issues */
791 issues: JIRAIssue[]
792 /** The PR metadata */
793 pr: BitBucketServerPRDSL
794 /** The commits associated with the pull request */
795 commits: BitBucketServerCommit[]
796 /** The comments on the pull request */
797 comments: BitBucketServerPRActivity[]
798 /** The activities such as OPENING, CLOSING, MERGING or UPDATING a pull request */
799 activities: BitBucketServerPRActivity[]
800 ```
801
802 You can see more in the docs for [Danger + BitBucket Server](http://danger.systems/js/usage/bitbucket_server.html).
803
804 -- [@azz]
805
806- Don't check for same user ID on comment when running as a GitHub App. [@tibdex]
807
808## 3.1.8
809
810- Improvements to the Flow definition file. [@orta]
811- Improve path generator for danger-runner. [@Mifi]
812- Update the PR DSL to include bots. [@orta]
813- Add utility function to build tables in Markdown [@keplersj]
814
815## 3.1.7
816
817- Minor error reporting improvements. [@orta]
818
819## 3.1.6
820
821- Move more code to only live inside functions. [@orta]
822
823## 3.1.5
824
825- Fix --base options for danger local. [@peterjgrainger]
826- Fix a minor typo in Semaphore CI setup. [@hongrich]
827- Fix for capitalized Dangerfiles in CI environment. [@wizardishungry]
828- Fix `danger local` crashing when comparing master to HEAD with no changes. [@orta]
829
830## 3.1.4
831
832- Register danger-runner as a package binary. [@urkle]
833
834## 3.1.2-3.1.3
835
836- Peril typings to the Danger DSL. [@orta]
837- Reference docs updates for the website. [@orta]
838
839## 3.1.1
840
841- Allows `danger runner` (the hidden command which runs the process) to accept unknown command flags (such as ones
842 passed to it via `danger local`.) - [@adam-moss]/[@orta]
843
844## 3.1.0
845
846- Adds a new command `danger local`.
847
848 This command will look between the current branch and master and use that to evaluate a dangerfile. This is aimed
849 specifically at tools like git commit hooks, and for people who don't do code review.
850
851 `danger.github` will be falsy in this context, so you could share a dangerfile between `danger local` and `danger ci`.
852
853 When I thought about how to use it on Danger JS, I opted to make another Dangerfile and import it at the end of the
854 main Dangerfile. This new Dangerfile only contains rules which can run with just `danger.git`, e.g. CHANGELOG/README
855 checks. I called it `dangerfile.lite.ts`.
856
857 Our setup looks like:
858
859 ```json
860 "scripts": {
861 "prepush": "yarn build; yarn danger:prepush",
862 "danger:prepush": "yarn danger local --dangerfile dangerfile.lite.ts"
863 // [...]
864 ```
865
866You'll need to have [husky](https://www.npmjs.com/package/husky) installed for this to work. - [@orta]
867
868- STDOUT formatting has been improved, which is the terminal only version of Danger's typical GitHub comment style
869 system. It's used in `danger pr`, `danger ci --stdout` and `danger local`. - [@orta]
870- Exposed a get file contents for the platform abstraction so that Peril can work on many platforms in the future -
871 [@orta]
872
873### 3.0.5
874
875- Added support for Bitrise as a CI Provider - [@tychota]
876- Nevercode ENV var fixes - [@fbartho]
877
878### 3.0.4
879
880- Paginate for issues - [@orta]
881
882### 3.0.3
883
884- Added support for Nevercode.io as a CI Provider - [@fbartho]
885
886### 3.0.2
887
888- Don't log ENV vars during a run - thanks @samdmarshall. - [@orta]
889
890### 3.0.1
891
892- Bug fixes and debug improvements. If you're interested run danger with `DEBUG="*" yarn danger [etc]` and you'll get a
893 _lot_ of output. This should make it much easier to understand what's going on. - [@orta]
894
895### 3.0.0
896
897- Updates to the CLI user interface. Breaking changes for everyone.
898
899 **TLDR** - change `yarn danger` to `yarn danger ci`.
900
901 Danger JS has been fighting an uphill battle for a while with respects to CLI naming, and duplication of work. So, now
902 it's been simplified. There are four user facing commands:
903
904 - `danger init` - Helps you get started with Danger
905 - `danger ci` - Runs Danger on CI
906 - `danger process` - Like `ci` but lets another process handle evaluating a Dangerfile
907 - `danger pr` - Runs your local Dangerfile against an existing GitHub PR. Will not post on the PR
908
909 This release deprecates running `danger` on it's own, so if you have `yarn danger` then move that be `yarn danger ci`.
910
911 Each command name is now much more obvious in it intentions, I've heard many times that people aren't sure what
912 commands do and it's _is_ still even worse in Danger ruby. I figure now is as good a time as any a good time to call
913 it a clean slate.
914
915 On a positive note, I gave all of the help screens an update and tried to improve language where I could.
916
917* [@orta]
918
919### 2.1.9-10
920
921- Fix to `danger pr` and `danger` infinite looping - [@orta]
922
923### 2.1.8
924
925- Add a note in `danger pr` if you don't have a token set up - [@orta]
926- Bunch of docs updates - [@orta]
927
928### 2.1.7
929
930- Fix Codeship integration - [@caffodian]
931- Updates documentation dependencies - [@orta]
932- Fixes to running `danger` with params - [@orta]
933- Fixes for `danger pr` not acting like `danger` WRT async code - [@orta]
934- Fixes `tsconfig.json` parse to be JSON5 friendly - [@gantman]
935- Fixes for `danger.github.thisPR` to use the base metadata for a PR, I'm too used to branch workflows - [@orta]
936
937### 2.1.6
938
939- Updates dependencies - [@orta]
940- Link to the build URL if Danger can find it in the CI env - [@orta]
941- Removes the "couldn't post a status" message - [@orta]
942
943### 2.1.5
944
945- The TS compiler will force a module type of commonjs when transpiling the Dangerfile - [@orta]
946
947### 2.1.4
948
949- Adds a CLI option for a unique Danger ID per run to `danger` and `danger process`, so you can have multiple Danger
950 comments on the same PR. - [@orta]
951
952### 2.1.1 - 2.1.2 - 2.1.3
953
954- Fixes/Improvements for `danger init` - [@orta]
955
956### 2.1.0
957
958- Adds a new command for getting set up: `danger init` - [@orta]
959- Fix double negative in documentation. [@dfalling]
960- Fix `gloabally` typo in documentation. [@dfalling]
961
962### 2.0.2 - 2.0.3
963
964- Adds a warning when you try to import Danger when you're not in a Dangerfile - [@orta]
965- Exports the current process env to the `danger run` subprocess - [@orta]
966
967### 2.0.1
968
969- Potential fixes for CLI sub-commands not running when packaging danger - [@orta]
970
971### 2.0.0
972
973- Fixes the `danger.js.flow` fix to handle exports correctly, you _probably_ need to add
974 `.*/node_modules/danger/distribution/danger.js.flow` to the `[libs]` section of your settings for it to work though -
975 [@orta]
976
977### 2.0.0-beta.2
978
979- Fixes a bug with `danger.github.utils` in that it didn't work as of b1, and now it does :+1: - [@orta]
980- Ships a `danger.js.flow` in the root of the project, this may be enough to support flow typing, thanks to [@joarwilk]
981 and [flowgen](https://github.com/joarwilk/flowgen) - [@orta]
982
983### 2.0.0-beta.1
984
985- Converts the command `danger` (and `danger run`) to use `danger process` under the hood. What does this do?
986
987 - Dangerfile evaluation is in a separate process, run without a vm sandbox. This fixes the async problem which we
988 created `schedule` for. Previously, any async work in your Dangerfile needed to be declared to Danger so that it
989 knew when all of the work had finished. Now that the running happens inside another process, we can use the
990 `on_exit` calls of the process to know that all work is done. So, _in Danger_ (not in Peril) async code will work
991 just like inside a traditional node app.
992
993 - Makes `danger process` a first class citizen. This is awesome because there will be reliable support for other
994 languages like [danger-swift], [danger-go] and more to come.
995
996 - The `danger process` system is now codified in types, so it's really easy to document on the website.
997
998- Adds a `--js` and `--json` option to `danger pr` which shows the output in a way that works with `danger process`.
999 This means you can preview the data for any pull request.
1000
1001./[@orta]
1002
1003### 2.0.0-alpha.20
1004
1005Moves away from vm2 to a require-based Dangerfile runner. This removes the sandboxing aspect of the Dangerfile
1006completely, but the sandboxing was mainly for Peril and I have a plan for that.
1007
1008https://github.com/danger/peril/issues/159
1009
1010I would like to move the main parts of Danger JS to also work like `danger process`, so I'll be continuing to work as a
1011alpha for a bit more. One interesting side-effect of this could be that I can remove `schedule` from the DSL. I've not
1012tested it yet though. Turns out this change is _real_ hard to write tests for. I've made #394 for that.
1013
1014./[@orta]
1015
1016### 2.0.0-alpha.18 - 19
1017
1018- Moves internal methods away from Sync to avoid problems when running in Peril - [@ashfurrow]
1019- Passes through non-zero exit codes from `danger process` runs - [@ashfurrow]
1020
1021### 2.0.0-alpha.17
1022
1023- Improve CircleCI PR detection
1024
1025### 2.0.0-alpha.16
1026
1027Some UX fixes:
1028
1029- Don't show warnings about not setting a commit status (unless in verbose) - [@orta]
1030- Delete duplicate Danger message, due to fast Peril edits - [@orta]
1031- Show Peril in the commit status if inside Peril, not just Danger - [@orta]
1032- [internal] Tightened the typings on the commands, and abstracted them to share some code - [@orta]
1033
1034### 2.0.0-alpha.15
1035
1036- Updates `diffForFile`, `JSONPatchForFile`, and `JSONDiffForFile` to include created and removed files - #368 -
1037 [@bdotdub]
1038
1039### 2.0.0-alpha.14
1040
1041- Adds a blank project generated in travis 8 to test no-babel or TS integration - [@orta]
1042- Improvements to `danger process` logging, and build fails correctly #363 - [@orta]
1043
1044### 2.0.0-alpha.13
1045
1046- Improve the error handling around the babel API - #357 - [@orta]
1047- Move back to the original URLs for diffs, instead of relying on PR metadata - [@orta]
1048- Updates the types for `schedule` to be more accepting of what it actually takes - [@orta]
1049
1050### 2.0.0-alpha.12
1051
1052- Fixed #348 invalid json response body error on generating a diff - felipesabino
1053- Potential fix for ^ that works with Peril also - [@orta]
1054
1055### 2.0.0-alpha.11
1056
1057- Doh, makes the `danger process` command actually available via the CLI - [@orta]
1058
1059### 2.0.0-alpha.10
1060
1061- Adds a `danger process` command, this command takes amn argument of a process to run which expects the Danger DSL as
1062 JSON in STDIN, and will post a DangerResults object to it's STDOUT. This frees up another process to do whatever they
1063 want. So, others can make their own Danger runner.
1064
1065 An example of this is [Danger Swift][danger-swift]. It takes a [JSON][swift-json] document via [STDIN][swift-stdin],
1066 [compiles and evaluates][swift-eval] a [Swift file][swift-dangerfile] then passes the results back to `danger process`
1067 via [STDOUT][swift-stdout].
1068
1069 Another example is this simple Ruby script:
1070
1071 ```ruby
1072 #!/usr/bin/env ruby
1073
1074 require 'json'
1075 dsl_json = STDIN.tty? ? 'Cannot read from STDIN' : $stdin.read
1076 danger = JSON.parse(dsl_json)
1077 results = { warnings: [], messages:[], fails: [], markdowns: [] }
1078
1079 if danger.github.pr.body.include? "Hello world"
1080 results.messages << { message: "Hey there" }
1081 end
1082
1083 require 'json'
1084 STDOUT.write(results.to_json)
1085 ```
1086
1087 Which is basically Ruby Danger in ~10LOC. Lols.
1088
1089 This is the first release of the command, it's pretty untested, but [it does work][swift-first-pr]. - [@orta]
1090
1091[danger-swift]: https://github.com/danger/danger-swift
1092[swift-json]: https://github.com/danger/danger-swift/blob/master/fixtures/eidolon_609.json
1093[swift-stdin]:
1094 https://github.com/danger/danger-swift/blob/1576e336e41698861456533463c8821675427258/Sources/Runner/main.swift#L9-L11
1095[swift-eval]:
1096 https://github.com/danger/danger-swift/blob/1576e336e41698861456533463c8821675427258/Sources/Runner/main.swift#L23-L40
1097[swift-dangerfile]:
1098 https://github.com/danger/danger-swift/blob/1576e336e41698861456533463c8821675427258/Dangerfile.swift
1099[swift-stdout]:
1100 https://github.com/danger/danger-swift/blob/1576e336e41698861456533463c8821675427258/Sources/Runner/main.swift#L48-L50
1101[swift-first-pr]: https://github.com/danger/danger-swift/pull/12
1102
1103### 2.0.0-alpha.9
1104
1105- Uses the Babel 7 alpha for all source compilation with JS, Flow+JS and TS. This worked without any changes to our
1106 internal infra which is pretty awesome. All TS tests passed. Babel 7 is still in alpha, but so is Danger 2.0 - so I'm
1107 happy to keep Danger in a pretty long alpha, till at least Babel 7 is in beta.
1108
1109 It also still supports using TypeScript via the "`typescript"` module, if you have that installed. - [@orta]
1110
1111- `danger.github.thisPR` now uses the PR's head, not base - [@orta]
1112
1113### 2.0.0-alpha.8
1114
1115- Uses the GitHub `diff_url` instead of the `diff` version header, as it conflicted with Peril - [@orta]
1116- Handle exceptions in Dangerfile and report them as failures in Danger results - [@macklinu]
1117
1118### 2.0.0-alpha.6-7
1119
1120- Expose a Promise object to the external GitHub API - [@orta]
1121
1122### 2.0.0-alpha.4-5
1123
1124- Allow running a dangerfile entirely from memory using the `Executor` API - [@orta]
1125
1126### 2.0.0-alpha.2-3
1127
1128- Removes the `jest-*` dependencies - [@orta]
1129
1130### 2.0.0-alpha.1
1131
1132- Support [a vm2](https://github.com/patriksimek/vm2) based Dangerfile runner as an alternative to the jest
1133 infrastructure. There are a few main reasons for this:
1134
1135 - I haven't been able to completely understand how Jest's internals work around all of the code-eval and pre-requisite
1136 setup, which has made it hard to work on some more complex Peril features.
1137
1138 - Jest releases are every few months, personally I love this as a user of Jest, as an API consumer it can be difficult
1139 to get changes shipped.
1140
1141 - The fact that both Danger/Jest make runtime changes means that you need to update them together
1142
1143 - I have commit access to vm2, so getting changes done is easy
1144
1145 I like to think of it as having gone from Jest's runner which is a massive toolbox, to vm2 which is a tiny toolbox
1146 where I'll have to add a bunch of new tools to get everything working.
1147
1148 The _massive downside_ to this is that Danger now has to have support for transpiling via Babel, or from TypeScript
1149 unlike before, where it was a freebie inside Jest. Jest handled this so well. This means that a Dangerfile which used
1150 to "just work" with no config may not. Thus, IMO, this is a breaking major semver.
1151
1152 Is it likely that you need to make any changes? So far, it seems probably not. At least all of the tests with
1153 Dangerfiles original from the older Jest runner pass with the new version.
1154
1155 This is an alpha release, because it's knowingly shipped with some breakages around babel support, specifically:
1156
1157 - Babel parsing of relative imports in a Dangerfile aren't working
1158 - Some of the features which require the `regeneratorRuntime` to be set up aren't working yet
1159
1160 Those are blockers on a 2.0.0 release.
1161
1162### 1.2.0
1163
1164- Exposes an internal API for reading a file from a GitHub repo as `danger.github.utils.fileContents` - [@orta]
1165
1166 Ideally this is what you should be using in plugins to read files, it's what Danger uses throughout the codebase
1167 internally. This means that your plugin/dangerfile doesn't need to rely on running on the CI when instead it could run
1168 via the GitHub API.
1169
1170- Update prettier - [@orta]
1171- Removes dtslint as a dependency - sapegin/orta
1172
1173### 1.1.0
1174
1175- Support retrieve paginated pull request commit list - [@kwonoj]
1176- Add support for VSTS CI - [@mlabrum]
1177- Remove the DSL duplication on the `danger` export, it wasn't needed or used. - [@orta]
1178- Update to TypeScript 2.4.x - [@orta]
1179- Rename github test static_file to remove `:` from the filename to fix a checkout issue on windows - [@mlabrum]
1180
1181### 1.0.0
1182
1183Hello readers! This represents a general stability for Danger. It is mainly a documentation release, as it corresponds
1184to <http://danger.systems/js/> being generally available. I made the initial commit back in 20 Aug 2016 and now it's
118530th June 2017. It's awesome to look back through the CHANGELOG and see how things have changed.
1186
1187You can find out a lot more about the 1.0, and Danger's history on my
1188[Artsy blog post on the Danger 1.0](https://artsy.github.io/blog/2017/06/30/danger-one-oh-again/).
1189
1190- Adds inline docs for all CI providers - [@orta]
1191
1192### 0.21.1
1193
1194- Use HTTP for the GitHub status check target URL - macklinu
1195- Correct some examples in node-app - clintam
1196- Add support for buddybuild CI - benkraus/clintam
1197- Add support for GithHub Apps API (no GET /user) - clintam
1198
1199### 0.21.0
1200
1201- Posts status reports for passing/failing builds, if the account for danger has access - [@orta]
1202- Adds prettier to the codebase - [@orta]
1203- Converts a bunch of Danger's dangerfile into a plugin -
1204 [danger-plugin-yarn](https://github.com/orta/danger-plugin-yarn) - [@orta]
1205
1206This is my first non-trivial plugin, based on infrastructure from @macklinu. Plugins are looking great, you can get some
1207info at <https://github.com/macklinu/generator-danger-plugin>.
1208
1209- Docs updates for the website - [@orta]
1210
1211### 0.20.0
1212
1213- Fix `danger pr` commands are not running on windows - kwonoj
1214- Fix broken link in getting started docs - frozegnome
1215- Do not delete comment written from user have same userid for danger - kwonoj
1216- Fix link to `jest` in getting started docs - palleas
1217- Fix yarn install instruction in getting started docs - palleas
1218
1219### 0.19.0
1220
1221- Update to Jest 20 - macklinu
1222- Change the danger.d.ts to use module exports instead of globals - [@orta]
1223- Render markdown inside `message()`, `warn()`, and `fail()` messages. - macklinu
1224
1225An example:
1226
1227```js
1228fail(`Missing Test Files:
1229
1230- \`src/lib/components/artist/artworks/__tests__/index-tests.tsx\`
1231- \`src/lib/components/artwork_grids/__tests__/infinite_scroll_grid-tests.tsx\`
1232- \`src/lib/containers/__tests__/works_for_you-tests.tsx\`
1233
1234If these files are supposed to not exist, please update your PR body to include "Skip New Tests".`)
1235```
1236
1237Will result in:
1238
1239<table>
1240 <thead>
1241 <tr>
1242 <th width="50"></th>
1243 <th width="100%" data-danger-table="true">Fails</th>
1244 </tr>
1245 </thead>
1246 <tbody>
1247<tr>
1248 <td>:no_entry_sign:</td>
1249 <td>Missing Test Files:
1250
1251- `src/lib/components/artist/artworks/__tests__/index-tests.tsx`
1252- `src/lib/components/artwork_grids/__tests__/infinite_scroll_grid-tests.tsx`
1253- `src/lib/containers/__tests__/works_for_you-tests.tsx`
1254
1255If these files are supposed to not exist, please update your PR body to include "Skip New Tests".
1256
1257</td>
1258 </tr>
1259 </tbody>
1260</table>
1261
1262### 0.18.0
1263
1264- Adds `github.api`. This is a fully authenticated client from the [github](https://www.npmjs.com/package/github) npm
1265 module. - @orta
1266
1267 An easy example of it's usage would be using Danger to add a label to your PR. Note that Danger will have the
1268 permissions for your account, so for OSS repos - this won't work.
1269
1270 ```js
1271 danger.github.api.issues.addLabels({
1272 owner: "danger",
1273 repo: "danger-js",
1274 number: danger.github.pr.number,
1275 labels: ["Danger Passed"],
1276 })
1277 ```
1278
1279 Yeah, that's a bit verbose, I agree. So, there's also `github.thisPR` which should simplify that. It aims to provide a
1280 lot of the values for the current PR to use with the API.
1281
1282 ```js
1283 const github = danger.github
1284 github.api.issues.addLabels({ ...github.thisPR, labels: ["Danger Passed"] })
1285 ```
1286
1287 You could use this API for a bunch of things, here's some quick ideas:
1288
1289 - Request specific reviewers when specific files change (`api.pullRequests.createReviewRequest`)
1290 - Add a label for when something passes or fails (`api.issues.addLabels`)
1291 - Verifying if someone is in your org? (`api.orgs.checkMembership`)
1292 - Updating Project tickets to show they have a PR (`api.projects.updateProject`)
1293
1294### 0.17.0
1295
1296- [Enhancements to `danger.git.diffForFile()`](https://github.com/danger/danger-js/pull/223) - @namuol
1297
1298 - Removed `diffTypes` second argument in favor of `result.added` and `result.removed`
1299 - Added `result.before` and `result.after` for easy access to full contents of the original & updated file
1300 - `danger.git.diffForFile` is now an `async` function
1301
1302 #### TL;DR:
1303
1304 ```js
1305 // In danger 0.16.0:
1306 const fullDiff = danger.git.diffForFile("foo.js")
1307 const addedLines = danger.git.diffForFile("foo.js", ["add"])
1308 const removedLines = danger.git.diffForFile("foo.js", ["del"])
1309
1310 // In the latest version:
1311 const diff = await danger.git.diffForFile("foo.js")
1312 const fullDiff = diff.diff
1313 const addedLines = diff.added
1314 const removedLines = diff.removed
1315 const beforeFileContents = diff.before
1316 const afterFileContents = diff.after
1317 ```
1318
1319- Update internal test fixture generation docs - namuol
1320
1321### 0.16.0
1322
1323- Adds a `diffTypes` option to `diffForFile` - alex3165
1324- Add Buildkite CI source - jacobwgillespie
1325
1326### 0.15.0
1327
1328- When a Dangerfile fails to eval, send a message to the PR - [@orta]
1329
1330### 0.14.2
1331
1332- Updated jest-\* dependencies to 19.x - [@orta]
1333
1334 Updating the jest-\* dependencies seems to be exhibiting strange behavior in tests for windows if you update, and use
1335 windows, can you please confirm that everything is 👍
1336
1337- Added type shapings to `JSONPatchForFile` - [@orta]
1338- Replaced deprecated `lodash.isarray` package with `Array.isArray` - damassi
1339
1340### 0.14.1
1341
1342- Moved `@types/chalk` from dependencies to devDependencies - [@orta]
1343- Killed some stray console logs - [@orta]
1344- Updated the danger.d.ts - [@orta]
1345
1346### 0.14.0
1347
1348- TypeScript Dangerfiles are now support in Danger - [@orta]
1349
1350 We use TypeScript in Danger, and a lot of my work in Artsy now uses TypeScript (see:
1351 [JS2017 at Artsy](http://artsy.github.io/blog/2017/02/05/Front-end-JavaScript-at-Artsy-2017/#TypeScrip1t)), so I
1352 wanted to explore using TypeScript in Dangerfiles.
1353
1354 This is built on top of Jest's custom transformers, so if you are already using Jest with TypeScript, then you can
1355 change the `dangerfile.js` to `dangerfile.ts` and nothing should need changing ( except that you might have new
1356 warnings/errors ) (_note:_ in changing this for Danger, I had to also add the `dangerfile.ts` to the `"exclude"`
1357 section of the `tsconfig.json` so that it didn't change the project's root folder.)
1358
1359 This repo is now using both a babel Dangerfile (running on Circle CI) and a TypeScript one (running on Travis) to
1360 ensure that we don't accidentally break either.
1361
1362- Created a new `danger.d.ts` for VS Code users to get auto-completion etc - [@orta]
1363- Added a two new `git` DSL functions: `git.JSONDiffForFile(filename)` and `git.JSONPatchForFile(filename)`.
1364
1365 - `git.JSONPatchForFile`
1366
1367 This will generate a rfc6902 JSON patch between two files inside your repo. These patch files are useful as a
1368 standard, but are pretty tricky to work with in something like a Dangerfile, where rule terseness takes priority.
1369
1370 - `git.JSONDiffForFile`
1371
1372 This uses `JSONPatchForFile` to generate an object that represents all changes inside a Dangerfile as a single
1373 object, with keys for the changed paths. For example with a change like this:
1374
1375 ```diff
1376 {
1377 "dependencies": {
1378 "babel-polyfill": "^6.20.0",
1379 + "chalk": "^1.1.1",
1380 "commander": "^2.9.0",
1381 "debug": "^2.6.0"
1382 },
1383 }
1384 ```
1385
1386 You could become aware of what has changed with a Dangerfile in a `schedule`'d function like:
1387
1388 ```js
1389 const packageDiff = await git.JSONDiffForFile("package.json")
1390 if (packageDiff.dependencies) {
1391 const deps = packageDiff.dependencies
1392
1393 deps.added // ["chalk"],
1394 deps.removed // []
1395 deps.after // { "babel-polyfill": "^6.20.0", "chalk": "^1.1.1", "commander": "^2.9.0", "debug": "^2.6.0" }
1396 deps.before // { "babel-polyfill": "^6.20.0", "commander": "^2.9.0", "debug": "^2.6.0" }
1397 }
1398 ```
1399
1400 The keys: `added` and `removed` only exist on the object if:
1401
1402 - `before` and `after` are both objects - in which case `added` and `removed` are the added or removed keys
1403 - `before` and `after` are both arrays - in which case `added` and `removed` are the added or removed values
1404
1405- Exposed all global functions ( like `warn`, `fail`, `git`, `schedule`, ... ) on the `danger` object. - [@orta]
1406
1407 This is specifically to simplify building library code. It should not affect end-users. If you want to look at making
1408 a Danger JS Plugin, I'd recommend exposing a function which takes the `danger` object and working from that. If you're
1409 interested, there is an active discussion on plugin support in the DangerJS issues.
1410
1411- Improves messaging to the terminal - [@orta]
1412- Adds the ability to not have Danger post to GitHub via a flag: `danger run --text-only` - [@orta]
1413- Fix a crasher with `prs.find` #181 - [@orta]
1414
1415### 0.13.0
1416
1417- Add `danger.utils` DSL, which includes `danger.utils.href()` and `danger.utils.sentence()` - macklinu
1418
1419 We were finding that a lot of Dangerfiles needed similar functions, so we've added a `utils` object to offer functions
1420 that are going to be used across the board. If you can think of more functions you use, we'd love to add them. Ideally
1421 you shouldn't need to use anything but Danger + utils to write your Dangerfiles.
1422
1423 ```js
1424 danger.utils.href("http://danger.systems", "Danger") // <a href="http://danger.systems">Danger</a>
1425 danger.utils.sentence(["A", "B", "C"]) // "A, B and C"
1426 ```
1427
1428- Adds `danger.github.utils` - which currently has only one function: `fileLinks` - [@orta]
1429
1430 Most of the time people are working with a list of files (e.g. modified, or created) and then want to present
1431 clickable links to those. As the logic to figure the URLs is very GitHub specific, we've moved that into it's own
1432 object with space to grow.
1433
1434 ```js
1435 const files = danger.git.modified_files // ["lib/component/a.ts", "lib/component/b.ts"]
1436 const links = danger.github.utils.fileLinks(files) // "<a href='...'>a</a> and <a href='...'>b</a>"
1437 warn(`These files have changes: ${links}`)
1438 ```
1439
1440### 0.12.1
1441
1442- Add support for [Drone](http://readme.drone.io) - gabro
1443
1444### 0.12.0
1445
1446- Added support for handling async code in a Dangerfile - deecewan
1447
1448 This is still a bit of a work in progress, however, there is a new function added to the DSL: `schedule`.
1449
1450 A Dangerfile is evaluated as a script, and so async code has not worked out of the box. With the `schedule` function
1451 you can now register a section of code to evaluate across multiple tick cycles.
1452
1453 `schedule` currently handles two types of arguments, either a promise or a function with a resolve arg. Assuming you
1454 have a working Babel setup for this inside your project, you can run a Dangerfile like this:
1455
1456 ```js
1457 schedule(async () => {
1458 const thing = await asyncAction()
1459 if (thing) {
1460 warn("After Async Function")
1461 }
1462 })
1463 ```
1464
1465 Or if you wanted something simpler,
1466
1467 ```js
1468 schedule(resolved => {
1469 if (failed) {
1470 fail("Failed to run")
1471 }
1472 })
1473 ```
1474
1475- Adds new GitHub DSL elements - deecewan
1476
1477* `danger.github.issue` - As a PR is an issue in GitHub terminology, the issue contains a bit more metadata. Mainly
1478 labels, so if you want to know what labels are applied to a PR, use `danger.github.issue.labels`
1479* `danger.github.reviews` - Find out about your reviews in the new GitHub Reviewer systems,
1480* `danger.github.requested_reviewers` - Find out who has been requested to review a PR.
1481
1482- Updated TypeScript and Jest dependencies - [@orta]
1483- Add support for Github Enterprise via DANGER_GITHUB_API_BASE_URL env var - mashbourne
1484
1485### 0.11.3 - 0.11.5
1486
1487- Internal changes for usage with Peril - [@orta]
1488
1489- Add `danger pr --repl`, which drops into a Node.js REPL after evaluating the dangerfile - macklinu
1490- Add support for Codeship - deecewan
1491
1492### 0.11.0 - 0.11.2
1493
1494- Add support for [Docker Cloud](https://cloud.docker.com) - camacho
1495
1496### 0.10.1
1497
1498- Builds which only use markdown now only show the markdown, and no violations table is shown - mxstbr
1499
1500### 0.10.0
1501
1502- Adds support for running Danger against a PR locally - [@orta]
1503
1504The workflow is that you find a PR that exhibits the behavior you'd like Danger to run against, then edit the local
1505`Dangerfile.js` and run `yarn run danger pr https://github.com/facebook/jest/pull/2629`.
1506
1507This will post the results to your console, instead of on the PR itself.
1508
1509- Danger changes to your Dangerfile are not persisted after the run - [@orta]
1510- Add summary comment for danger message - kwonoj
1511- Add `jest-environment-node` to the Package.json - [@orta]
1512
1513### 0.9.0
1514
1515- Adds support for `git.commits` and `github.commits` - [@orta]
1516
1517 Why two? Well github.commits contains a bunch of github specific metadata ( e.g. GitHub user creds, commit comment
1518 counts. ) Chances are, you're always going to use `git.commits` however if you want more rich data, the GitHub one is
1519 available too. Here's an example:
1520
1521```js
1522const merges = git.commits.filter(commit => commit.message.include("Merge Master"))
1523if (merges.length) {
1524 fail("Please rebase your PR")
1525}
1526```
1527
1528- Support custom dangerfile via `-d` commandline arg - kwonoj
1529- Allow debug dump output via `DEBUG=danger:*` environment variable - kwonoj
1530- Adds surf-build ci provider - kwonoj
1531- Forward environment variables to external module constructor - kwonoj
1532
1533### 0.8.0
1534
1535- Support `danger run -ci` to specify external CI provider - kwonoj
1536- Adds `--verbose` to `danger`, which for now will echo out all the URLs Danger has requested - [@orta]
1537- Migrate codebase into TypeScript from flow - kwonoj
1538- Handle removing all sorts of import types for Danger in the Dangerfile - [@orta]
1539
1540### 0.7.3-4-5
1541
1542- A failing network request will raise an error - [@orta]
1543- Fix Dangerfile parsing which broke due to Peril related changes - [@orta]
1544- Tweak the npmignore, ship less random stuff to others - [@orta]
1545
1546### 0.7.2
1547
1548- Fixes to the shipped Flow/TS definitions - [@orta]
1549- Adds more functions the the internal Danger GitHub client - [@orta]
1550- Infrastructure work to allow Peril to run a Dangerfile - [@orta]
1551- Upgrade outdated ESLint packages - macklinu
1552- Enhance Windows OS compatibility - kwonoj
1553
1554### 0.7.1
1555
1556- Set exit code to 1 when running `danger` throws an error - macklinu
1557- Add Jenkins CI source - macklinu
1558- Add .editorconfig - macklinu
1559- Adds jest-runtime to the dependencies - [@orta]
1560
1561### 0.7.0
1562
1563- You can build and run in vscode using your own custom `env/development.env` file. This is useful because you can use
1564 the debugger against a real PR. See `env/development.env.example` for syntax. - [@orta]
1565
1566- Uses `jest-transform` and `jest-runtime` to eval and apply babel transforms.
1567
1568 This does two things, makes it feasible to do [hosted-danger](https://github.com/danger/peril) and makes it possible
1569 to write your Dangerfile in a way that's consistent with the rest of your JavaScript. - [@orta]
1570
1571- Add tests directory to .npmignore - macklinu
1572- Update to Jest 18 - macklinu
1573
1574### 0.6.10
1575
1576- Brings back the ability to emulate a fake CI run locally via `danger` - [@orta]
1577
1578### 0.6.9
1579
1580- Makes `babel-polyfill` a direct dependency, this is because it is actually an implicit dependency in the app. I'm not
1581 sure how I feel about this, I guess if we use a part of it in the babel translation of a user's Dangerfile them I'm OK
1582 with it. - [@orta]
1583
1584### 0.6.6 - 0.6.7 - 0.6.8
1585
1586- Ship flow annotations with the npm module - [@orta]
1587
1588### 0.6.5
1589
1590- Adds more node instances to travis - romanki + orta
1591- Adds support for Semaphore CI - [@orta]
1592
1593### 0.6.4
1594
1595- The env vars `DANGER_TEST_REPO` and `DANGER_TEST_PR` will allow you initialize the FakeCI with a repo of your choice.
1596 See README.md for more info
1597- Improved error messaging around not including a `DANGER_GITHUB_API_TOKEN` in the ENV - nsfmc / orta
1598- Adds support for getting the diff for a specific file from git: e.g.
1599
1600```js
1601// Politely ask for their name on the entry too
1602const changelogDiff = danger.git.diffForFile("changelog.md")
1603const contributorName = danger.github.pr.user.login
1604if (changelogDiff && changelogDiff.indexOf(contributorName) === -1) {
1605 warn("Please add your GitHub name to the changelog entry, so we can attribute you.")
1606}
1607```
1608
1609### 0.6.3
1610
1611- Does not break commonmark on GitHub - [@orta]
1612- upgrades to flow 0.35.0 and fixes associated type errors in covariant/invariant interfaces - nsfmc
1613- omits flow requirement for new test files - nsfmc
1614- adds support for circleci - nsfmc
1615- defines CISource properties in flow as read-only - nsfmc
1616
1617### 0.5.0
1618
1619- `danger.pr` -> `danger.github.pr`, I've also created interfaces for them - [@orta]
1620- `warn`, `message`, `markdown` are all ported over to DangerJS - [@orta]
1621- Shows a HTML table for Danger message - [@orta]
1622- Now offers a Flow-typed definition file, it's not shipped to their repo yet, you can make it by
1623 `npm run export-flowtype` - [@orta]
1624- Started turning this into a real project by adding tests - [@orta]
1625
1626### 0.0.5-0.0.10
1627
1628- Changes some files cashing, added some logs, a bit of error reporting, and verifying everything works through npm -
1629 [@orta]
1630
1631### 0.0.4
1632
1633- Danger edit an existing post, and delete it when it's not relevant - [@orta]
1634
1635### 0.0.3
1636
1637- Danger will post a comment on a GitHub PR with any Fails - [@orta]
1638
1639### 0.0.2
1640
1641OK, first usable for others version. Only supports GitHub and Travis CI.
1642
1643You can run by doing:
1644
1645```sh
1646danger
1647```
1648
1649Make sure you set a `DANGER_GITHUB_API_TOKEN` on your CI -
1650[see the Ruby guide](http://danger.systems/guides/getting_started.html#setting-up-danger-to-run-on-your-ci) for that.
1651
1652Then you can make a `dangerfile.js` (has to be lowercase, deal with it.) It has access to a whopping 2 DSL attributes.
1653
1654```sh
1655pr
1656git
1657fail(message: string)
1658```
1659
1660`pr` _probably_ won't be sticking around for the long run, but if you're using a `0.0.2` release, you should be OK with
1661that. It's the full metadata of the PR, so
1662[this JSON file](https://raw.githubusercontent.com/danger/danger/master/spec/fixtures/github_api/pr_response.json).
1663`git` currently has:
1664
1665```sh
1666git.modified_file
1667git.created_files
1668git.deleted_files
1669```
1670
1671which are string arrays of files.
1672
1673`fail(message: string)` will let you raise an error, and will make the process return 1 after the parsing has finished.
1674
1675Overall: your Dangerfile should look something like:
1676
1677```js
1678import { danger } from "danger"
1679
1680const hasChangelog = danger.git.modified_files.includes("changelog.md")
1681if (!hasChangelog) {
1682 fail("No Changelog changes!")
1683}
1684```
1685
1686That should do ya. I think. This doesn't support babel, and I haven't explored using other modules etc, so...
1687
1688./[@orta]
1689
1690### 0.0.1
1691
1692Not usable for others, only stubs of classes etc. - [@orta]
1693
1694[danger-swift]: https://github.com/danger/danger-swift#danger-swift
1695[danger-go]: https://github.com/bdotdub/danger-go
1696[@adam-moss]: https://github.com/adam-moss
1697[@adamnoakes]: https://github.com/adamnoakes
1698[@aghassi]: https://github.com/aghassi
1699[@ashfurrow]: https://github.com/ashfurrow
1700[@azz]: https://github.com/azz
1701[@caffodian]: https://github.com/caffodian
1702[@codestergit]: https://github.com/codestergit
1703[@cwright017]: https://github.com/Cwright017
1704[@cysp]: https://github.com/cysp
1705[@danielrosenwasser]: https://github.com/DanielRosenwasser
1706[@davidbrunow]: https://github.com/davidbrunow
1707[@dfalling]: https://github.com/dfalling
1708[@f-meloni]: https://github.com/f-meloni
1709[@fbartho]: https://github.com/fbartho
1710[@fwal]: https://github.com/fwal
1711[@happylinks]: https://github.com/happylinks
1712[@hongrich]: https://github.com/hongrich
1713[@hellocore]: https://github.com/HelloCore
1714[@imorente]: https://github.com/imorente
1715[@joarwilk]: https://github.com/joarwilk
1716[@johansteffner]: https://github.com/johansteffner
1717[@joshacheson]: https://github.com/joshacheson
1718[@keplersj]: https://github.com/keplersj
1719[@langovoi]: https://github.com/langovoi
1720[@mifi]: https://github.com/ionutmiftode
1721[@mxstbr]: https://github.com/mxstbr
1722[@ninjaprox]: https://github.com/ninjaprox
1723[@nminhnguyen]: https://github.com/NMinhNguyen
1724[@nornagon]: https://github.com/nornagon
1725[@orta]: https://github.com/orta
1726[@osmestad]: https://github.com/osmestad
1727[@patrickkempff]: https://github.com/patrickkempff
1728[@peterjgrainger]: https://github.com/peterjgrainger
1729[@randak]: https://github.com/randak
1730[@ravanscafi]: https://github.com/ravanscafi
1731[@rohit-smpx]: https://github.com/rohit-smpx
1732[@sajjadzamani]: https://github.com/sajjadzamani
1733[@sebinsua]: https://github.com/sebinsua
1734[@sgtcoolguy]: https://github.com/sgtcoolguy
1735[@sharkysharks]: https://github.com/sharkysharks
1736[@stevemoser]: https://github.com/stevemoser
1737[@stevenp]: https://github.com/stevenp
1738[@sunshinejr]: https://github.com/sunshinejr
1739[@tychota]: https://github.com/tychota
1740[@urkle]: https://github.com/urkle
1741[@wizardishungry]: https://github.com/wizardishungry
1742[@dblandin]: https://github.com/dblandin
1743[@paulmelnikow]: https://github.com/paulmelnikow
1744[@ds300]: https://github.com/ds300
1745[@jamime]: https://github.com/jamime
1746[@mrndjo]: https://github.com/mrndjo
1747[@bigkraig]: https://github.com/bigkraig
1748[@notjosh]: https://github.com/notjosh
1749[@iljadaderko]: https://github.com/IljaDaderko