UNPKG

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