- Fixes for the homebrew generated binaries - @hellocore
- Bitbucket Cloud: Allow DangerCI to get UUID from Bitbucket - @hellocore
- Update docs for GitLab - @orta
- Maybe fix deploys to GPR for Docker - @orta
- Add support for Cirrus CI - [@RDIL]
- Remove additional danger from pr generated json - @f-meloni
- Fix github actions checks - @f-meloni
- Support more events on GitHub actions - @f-meloni
- Fix binary files for BitBucket Server - @osmestad
- Allow GHE to use checks - [@adam-bratin]
- Fix structuredDiffForFile for BitBucket Server - @osmestad
- Fix Buddy.works isPR and use PR number instead of PR ID - [@mmiszy]
- remove jsome package and replace with prettyjson - [@watchinharrison]
- Add GitLab support to Jenkins provider - [@sandratatarevicova]
- Add Buddy.works Pipelines support - [@kristof0425]
- Added flag to bypass Jira/Issues - [@orieken]
- Improve docs for GitHub Actions - [@nguyenhuy]
- Get GitHub Actions event file pathname from env variable - @IljaDaderko
- GitHub Actions docs update - @orta
- Release only made for GitHub Actions - @orta
- Take commit hash from bitrise env - @f-meloni
- Use new env
BITBUCKET_REPO_FULL_NAME
in bitbucket pipeline. - [@Soyn] - Take commit hash from CI Source if available - @f-meloni
- Updates GitLab API to 10.x - [@awgeorge]
- Add retry handling for API requests - [@jtreanor]
- Fixes TS declarations - @orta
- Fix Github Actions documentation - @ravanscafi
- Improve Performance by Caching BitBucket Cloud Commits - @hellocore
- Add compliment message to comment template on Bitbucket Cloud - @hellocore
- Add option to set custom icon in messages - @rohit-smpx
- Expose BitBucketServerAPI - @NMinhNguyen
- Add support OAuth for BitBucket Cloud - @hellocore
- Allow
handleResults
to be called without agit
object - [@jtreanor]
- Fix for the GitLab dependency making danger not load - @f-meloni
- Fixed incorrect main comment template on Bitbucket Cloud - @hellocore
- Add BitBucket Cloud & BitBucket Pipelines support - @hellocore
- Add GitLab missing states - @f-meloni
- Fixes incorrect slug for builds from forks on Codefresh - @stevenp
- Un-hardcodes the repo in
danger.github.utils.createOrUpdatePR
- @ds300
- Cleans up the declarations a little bit - @orta
- Adds support for Codefresh CI - @stevenp
-
Update ts-jest to 24.0.2 - [@friederbluemle]
-
Adds a fix for the default name of Danger in status - @orta
-
Adds
danger.git.fileMatch.getKeyedPaths()
, providing more convenient access to paths. This replacesfileMatch.tap()
andfileMatch.debug()
.const components = fileMatch("components/**/*.js", "!**/*.test.js") const componentTests = fileMatch("!**/*.test.js") if (components.edited && !componentTests.edited) { warn( [ "This PR modified some components but none of their tests. <br>", "That's okay so long as it's refactoring existing code. <br>", "Affected files: ", components.getKeyedPaths().edited.join(", "), ].join("") ) }
This makes it much simpler to compose a collection of file checks - @paulmelnikow
-
Adds Chainsmoker, and expands the Danger DSL with the addition of
danger.git.fileMatch
.const documentation = danger.git.fileMatch("**/*.md") const packageJson = danger.git.fileMatch("package.json") const lockfile = danger.git.fileMatch("yarn.lock", "package-lock.json") if (documentation.edited) { message("Thanks - We :heart: our [documentarians](http://www.writethedocs.org/)!") } if (packageJson.modified && !lockfile.modified) { warn("This PR modified package.json, but not the lockfile") }
This makes it much simpler to compose a collection of file checks - @paulmelnikow
- Taken a stab at trying to make the commit status summary to feel better in both Danger & Peril @orta
- Adds a CLI option
--failOnErrors
so that you can forcedanger ci
to return a failed exit code on anyfail
s in a Dangerfile @f-meloni
- Send different build update keys based on the id on Bitbucket @f-meloni
- Add support for CodeBuild CI source @sharkysharks
- Enable Danger runs with different DangerIDs to post separate statuses @randak
- Docs: fix typo - [@hiroppy]
- Fixed: isCI check for Codeship - [@msteward]
- Fixed: Crash on BitbucketServer when the change type is unknown - @f-meloni
- Add
linesOfCode
inGitDSL
- @ninjaprox - Docs: document GitHubMergeRef type - @nornagon
- Adds some Debug logs for babel transformation - @orta
- Support multi-line import/require statements in Dangerfiles & possibly fix source-mapping for errors - @fbartho
- Return the DangerResults meta after sorting and merging operations - @f-meloni
- Make bitbucket generated signature less aggressive - @f-meloni
- Updates the import for octokit at the top of the danger.d.ts - @orta
- Handles the previews API correctly - @orta
- Removed
vm2
from Danger, it's not being used in Peril now - @orta danger pr
with--json
or --js` now don't require a Dangerfile to be present - @orta
- Remove dead links to example danger files. - @stevemoser
- Allow danger-pr to work also on Bitbucket Server - @f-meloni
- Fix for nulls in modified_files - @orta
- Use new APIs in OctoKit - @orta
- More fixes for
GITHUB_URL
instead of justDANGER_GITHUB_URL
for GitHub Enterprise. - @Aghassi
- Lets you use
GITHUB_URL
instead of justDANGER_GITHUB_URL
for GitHub Enterprise. - @Aghassi
- Fix issue where the PR command could not be run with a GitHub Enterprise URL.
- Specify filename when loading Babel options. Fixes #664 (#804) - @NMinhNguyen
- Running Danger on GitHub Actions now runs Danger from source code. Before that, Danger on GitHub Actions is stuck at v5.0.0-beta-24. @dtinth
- Make use of GitHub Checks optional and disabled by default, pass
--use-github-checks
to enable. @cysp
-
Updates
@octokit/rest
to v16.x.x - this is a major semver change on their end, which I know it breaks some of Artsy/Danger's Peril Dangerfiles, so it's possible that it could break your Dangerfiles too. How do you know?Roughly, if you have any code that uses
danger.github.api
then it's very possible that you need to update your code.There are update notes here, but if you're using TypeScript then it'll raise the issues at a type-check level. Note, that this version may cause issues if you are using GitHub Enterprise, you can get updates here.
-
Allow sub-processes to pass their own name an href so that it doesn't say made by Danger JS @orta
This is done by extending the
DangerResults
object passed back to Danger JS, by adding a meta section to the JSON:{ "markdowns": [], "fails": [], "warnings": [], "messages": [], "meta": { "runtimeHref": "https://mysite.com", "runtimeName": "My Danger Runner" } }
"meta"
is optional, and will fall back to the DangerJS one. -
Removed a dependency (voca) now that we're using TypeScript and have access to .includes @orta
- Fix issue with detecting Babel if
babel-core
is installed - @sajjadzamani
- Fix detection of GitHub Actions event types @cysp
- Add commit ID to the comment footer [danger#168] - @randak
- Add support for
COPY
change type to fix a BitBucket Server regression in danger/danger-js#764 - @sebinsua - Add support for older Babel versions (prior 7) @sajjadzamani
- Revert removal of implicit
<p>
tag from danger/danger-js#754 and add distinction depending on containing markdown or not - [@hanneskaeufler]
- Update comment instead deleting, if it has replies (BitBucket Server) @langovoi
- Fix BitBucket Server GitDSL @langovoi
- Add support of paged APIs of BitBucket Server @langovoi
- Adds a CLI flag for custom Danger Runners to be able to request a URL to a JSON file instead of receiving the entire DSL as a big JSON dump. We're exploring using this in Danger Swift with danger/swift#108 - @orta
- Adds
html_url
to the PR JSON declaration - @orta - 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
have a process that might not be ready to grab the DSL instantly from danger-js. The subprocess can print the message
danger://send-dsl
to stdout and danger-js will re-send the DSL via STDIN. danger/swift#108. - @orta - Allows a FakeCI to get a FakePlatform, should fix #767 - @orta
- Fix
GitJSONDSL
anddiffForFile
for BitBucket Server - @langovoi
- Add support for personal tokens of BitBucket Server - @langovoi
- Ships a command
danger-js
which means other languages could also use the command danger and they won't conflict with the JS version - @orta
- Checks for the JSON results file reported by a subprocess before accessing it - @orta
- Improves debug logging, messaging on CI about status updates - @orta
- Better detection of json results: {} from a sub-process - @orta
- CLI Args are actually passed to subprocess instead of an empty object - @orta
- Fix Netlify integration when repo url includes an access token - @imorente
- Add CI integration for Netlify - @imorente
- Removes an accidental import - @orta
- Adds an internal flag for disabling checks support when being controller by Peril - @orta
- Fix
danger pr
- @orta
- Fix GitHub checks API payload - [@pveyes]
- Fix passing stdout from the sub-process back to the user - @orta
- Fix handling a
"pending"
status update properly using Bitbucket API - @sgtcoolguy - Fix #614 - Posting status updates to Github using issue workflow broken - @sgtcoolguy
- Fix vertical alignment in GitHub issue template - @patrickkempff
-
Hah, my computer ran out opf power mid-deploy, and now I have to ship another build to make sure the brew versions of Danger JS are set up correctly. - orta
-
Hah, I managed to run the same 'deploy major' command instead. So... Happy v6! - orta
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 thoroughly in production.
This release bring support for GitHub actions. It does this merging in some of the responsibilities that used to live inside Peril into Danger.
Notes about Danger JS:
- Adds support for running remote GitHub files via the
--dangerfile
argument. It supports urls like:orta/peril-settings/file.ts
which grabsfile.ts
fromorta/peril-settings
. - Adds support for taking a GitHub Actions event JSON and exposing it in the
default export
function in the same way that Peril does it. - Adds a GitHubActions CI provider - it declares that it can skip the PR DSL so that Danger can also run against issues/other events
- Handle remote transpilation of the initial Dangerfile correctly
- Adds support for not include a tsconfig for typescript projects, danger will use the default config if it can't find one in your project
- Hardcodes the GitHub Actions userID into danger ( blocked by https://platform.github.community/t/obtaining-the-id-of-the-bot-user/2076 )
- Allows running with a simplified DSL when running on a GitHub action that isn't a PR
- Use new env vars for GitHub Actions
There is now 2 ways for a subprocess to communicate to Danger JS - prior to 5.x it was expected that a subprocess would
pass the entire JSON results back via STDOUT to the host Danger JS process, but sometimes this was unreliable. Now a
subprocess can pass a JSON URL for Danger JS by looking in STDOUT for the regex /danger-results:\/\/*.+json/
.
There is now a JSON schema for both directions of the communication for sub-processes:
- The data Danger sends to the subprocess:
source/danger-incoming-process-schema.json
- The data Danger expects from the subprocess:
source/danger-outgoing-process-schema.json
This can be used for language DSL generation and/or formal verification if you're interested. Or, for just feeling completely sure about what is being sent to your process without diving into the Danger JS codebase.
Also, danger pr
now accepts a --process
arg.
- Add logic for "DANGER_DISABLE_TRANSPILATION" env [@markelog]
- Jenkins: Respect
CHANGE_URL
/CHANGE_ID
for GitHub and BitBucket Server @azz - Docs: Guides - Update link to apollo-client dangerfile.ts example [@andykenward]
- Fix crash that may occur when no message is set on generic event [@flovilmart]
- Add support to proxy requests using
HTTP_PROXY
orHTTPS_PROXY
environment variables [@steprescott]
- Supports installation using Homebrew [@thii]
- Some experimental beta builds which didn't turn out very useful
- Adds a fallback to
GITHUB_TOKEN
if it's in the ENV - orta - There was some versioning faffing going on
-
Adds the ability to send a PR from a Dangerfile easily.
import { danger } from "danger" export default async () => { // This is a map of file to contents for things to change in the PR const welcomePR = { LICENSE: "[the MIT license]", "README.md": "[The README content]", } // Creates a new branch called `welcome`, from `master`. Creates a commit with // the changes above and the message "Sets up ...". Then sends a PR to `orta/new-repo` // with the title "Welcome to ..." and the body "Here is ...". await danger.github.utils.createOrUpdatePR( { title: "Welcome to [org]", body: "Here is your new repo template files", owner: "orta", repo: "new-repo", baseBranch: "master", newBranchName: "welcome", commitMessage: "Sets up the welcome package", }, welcomePR ) }
OK, so this one is cool. This function will create/update an existing PR. You pass in a config object that defines; the commit, the branch and the PR metadata and then this function will go and set all that up for you.
The second argument is a fileMap, this is an object like
{ "README.md": "[the content]" }
and it defines what files should change in the commit. The files are completely changed to the content in the fileMap, so if you're making a single line change - you need to submit the enfile file.This is all based on my module memfs-or-file-map-to-github-branch so if you need a set of lower level APIs for PR/branch needs,
import
that and use it. - @orta
- Fixed a bug where Danger would fail to update status when there are no failures or messages @johansteffner
- Fixed a bug where Danger was throwing an error when removing any existing messages [@stefanbuck]
-
Updates Danger's runtime to work with Babel 7 - @adamnoakes
Breaking: 3.9.0 was the last version to support inline transpilation via Babel 6. Danger doesn't specify babel in its dependencies, so this warning won't show anywhere else.
- Adds CI integration for Concourse - @cwright017
- Adds debug logs to the vm2 runner used in Peril - @orta
- Adds a function to handle creating or adding a label on a PR/Issue. Works with both Danger and Peril:
danger.github.createOrAddLabel
- @orta
- Exposes some internals on module resolution to Peril - @orta
- Fix bitbucket error when trying to obtain a response json when the response code is 204 (which means that there is no response).
- Fix bitbucket link of the PR status, so it opens the web version of the PR, pointing to the Danger comment 646 - @acecilia
- Adapt emoji for Bitbucket server to fix "Database error has occurred" 645 - @acecilia
- Use the Peril Bot ID for the comment lookup checks - @orta
- Adds additional logging to handleResultsPostingToPlatform - @ashfurrow
- Fixes a crash if lodash isn't a transitive dependency in your node_modules - @orta
- Using the Checks API will now post a summary comment on a PR - @orta
- Logging / verification improvements for the subprocess - @orta
- Convert the
exec
indanger local
to aspawn
hopefully unblocking large diffs from going through it - @joshacheson
- Report the error in a commit status update when in verbose - @orta
- Improvements to PR detection on Team City - @markelog
- More work on
danger.github.utils.createUpdatedIssueWithID
. - @orta
-
Turns on the strict mode in the typescript compiler, this only gave build errors, so I was basically there anyway. This is so that the type defs will always pass inside environments where strict is already enabled. - @orta
-
Updates to TypeScript 2.9. - @orta
- Minor refactoring in GitHubUtils to allow Peril to re-create some of the util functions - @orta
- Updates type declarations to use top-level exports instead of a module augmentation - @DanielRosenwasser
- Bug fixes for
danger.github.utils.createUpdatedIssueWithID
- @orta
-
Improved debugging when using the GitHub OctoKit - @orta
-
Added
danger.github.utils.createUpdatedIssueWithID
which can be used to have danger continually update a single issue in a repo, for example:await danger.github.utils.createUpdatedIssueWithID("TestID", "Hello World", { title: "My First Issue", open: true, repo: "sandbox", owner: "PerilTest", })
Will first create, then update that issue with a new body. - @orta
- Improve checks support for Danger - orta
-
Adds support for the GH Checks API.
This brings some interesting architectural changes inside Danger, but more important to you dear reader, is that using the Checks API has some API restrictions. This makes in infeasible to re-use the user access token which we've previously been recommending for setup.
Instead there are two options:
- Use a GitHub app owned by Danger: https://github.com/apps/danger-js
- Use your own GitHub app.
The security model of the GitHub app means it's totally safe to use our GitHub app, it can only read/write to checks and has no access to code or organizational data. It's arguably safer than the previous issue-based comment.
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 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.If you want to run your own GitHub App, you'll need to set up a few ENV vars instead:
DANGER_GITHUB_APP_ID
- The app id, you can get this from your app's overview page at the bottomDANGER_GITHUB_APP_PRIVATE_SIGNING_KEY
- The whole of the private key as a string with\n
instead of newlinesDANGER_GITHUB_APP_INSTALL_ID
- The installation id after you've installed your app on an org
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 deprecating the issue based commenting (we use that same infra with bitbucket).
So now there are three ways to set up communications with GitHub, I'm not looking forwards to documenting that.
-
JSON diffs use the JSON5 parser, so can now ignore comments in JSON etc @orta
-
Allows the synchronous execution of multiple dangerfiles in one single "danger run".
Not a particularly useful feature for Danger-JS, but it means Peril can combine many runs into a single execution unit. This means people only get 1 message. @orta
- Updates vm2 to be an npm published version @orta
- Fix running Danger on issues with no comments for real @mxstbr
- Fix running Danger on issues with no comments @mxstbr
- Automatically rate limit concurrent GitHub API calls to avoid hitting GitHub rate limits @mxstbr
- Catch the github api error thrown from @octokit/rest [@Teamop]
- Replace preview media type of github pull request reviews api [@Teamop]
- Add support for Screwdriver CI [@dbgrandi]
- A Dangerfile can return a default export, and then Danger will handle the execution of that code @orta
- Changes the order of the text output in verbose, or when STDOUT is the only option @orta
- Prints a link to the comment in the build log @orta
- Fixed a bug where Danger posts empty main comment when it have one or more inline comments to post @codestergit
- fix bug when commiting .png files on BitBucket @Mifi
- Adds support for inline comments for bitbucket server. @codestergit
- Update dependencies @orta
- Fixed Babel 7 breaking due to invalid sourceFileName configuration [@kesne]
- Don't print error for commit status when there was no error @sunshinejr
- Fixed a bug where Danger would get access to all inline comments, thus deleting comments posted by other people @sunshinejr
- Fixed a bug where updating multiple inline comments caused a Javascript error @sunshinejr
- Improving reporting when multiple violations are o nthe same line of a file @sunshinejr
- Protection against nulls in the inline comment data @orta
-
Adds support for inline comments when using GitHub.
This is one of those "massive under the hood" changes, that has a tiny user DSL surface. From this point onwards
fail
,warn
,message
andmarkdown
all take an extra two optional params:file?: string
andline?: number
.Adding
file
andline
to the call of any exported communication function will trigger one of two things:- Danger will create a new comment inline inside your PR with your warning/message/fail/markdown
- Danger will append a in the main Danger comment with your warning/message/fail/markdown
Inline messages are edited/created/deleted with each subsequent run of
danger ci
in the same way the main comment does. This is really useful for: linters, test runners and basically anything that relies on the contents of a file itself.If you're using
danger process
to communicate with an external process, you can return JSON like:{ "markdowns": [ { "file": "package.swift", "line": 3, "message": "Needs more base" } ] // [...] }
-- @sunshinejr
-
Adds a data validation step when Danger gets results back from a process . @orta
- Adds support for TeamCity as a CI provider. @fwal
- Fixed Babel 7 breaking because of sourceFileName being defined wrong. @happylinks
-
Fix
committer
field issue - missing in Stash API by using commit author instead. [@zdenektopic] -
Adds a new command:
reset-status
This command is for setting the CI build status in advance of running Danger. If your Danger build relies on running tests/linters, then you might want to set the PR status (the red/green/yellow dots) to pending at the start of your build. You can do this by running
yarn danger reset-status
.
-
Add BitBucket Server support.
To use Danger JS with BitBucket Server: you'll need to create a new account for Danger to use, then set the following environment variables on your CI:
DANGER_BITBUCKETSERVER_HOST
= The root URL for your server, e.g.https://bitbucket.mycompany.com
.DANGER_BITBUCKETSERVER_USERNAME
= The username for the account used to comment.DANGER_BITBUCKETSERVER_PASSWORD
= The password for the account used to comment.
Then you will have a fully fleshed out
danger.bitbucket_server
object in your Dangerfile to work with, for example:import { danger, warn } from "danger" if (danger.bitbucket_server.pr.title.includes("WIP")) { warn("PR is considered WIP") }
The DSL is fully fleshed out, you can see all the details inside the [Danger JS Reference][ref], but the summary is:
danger.bitbucket_server. /** The pull request and repository metadata */ metadata: RepoMetaData /** The related JIRA issues */ issues: JIRAIssue[] /** The PR metadata */ pr: BitBucketServerPRDSL /** The commits associated with the pull request */ commits: BitBucketServerCommit[] /** The comments on the pull request */ comments: BitBucketServerPRActivity[] /** The activities such as OPENING, CLOSING, MERGING or UPDATING a pull request */ activities: BitBucketServerPRActivity[]
You can see more in the docs for Danger + BitBucket Server.
-- @azz
-
Don't check for same user ID on comment when running as a GitHub App. [@tibdex]
- Improvements to the Flow definition file. @orta
- Improve path generator for danger-runner. @Mifi
- Update the PR DSL to include bots. @orta
- Add utility function to build tables in Markdown @keplersj
- Minor error reporting improvements. @orta
- Move more code to only live inside functions. @orta
- Fix --base options for danger local. @peterjgrainger
- Fix a minor typo in Semaphore CI setup. @hongrich
- Fix for capitalized Dangerfiles in CI environment. @wizardishungry
- Fix
danger local
crashing when comparing master to HEAD with no changes. @orta
- Register danger-runner as a package binary. @urkle
- Allows
danger runner
(the hidden command which runs the process) to accept unknown command flags (such as ones passed to it viadanger local
.) - @adam-moss/@orta
-
Adds a new command
danger local
.This command will look between the current branch and master and use that to evaluate a dangerfile. This is aimed specifically at tools like git commit hooks, and for people who don't do code review.
danger.github
will be falsy in this context, so you could share a dangerfile betweendanger local
anddanger ci
.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 main Dangerfile. This new Dangerfile only contains rules which can run with just
danger.git
, e.g. CHANGELOG/README checks. I called itdangerfile.lite.ts
.Our setup looks like:
"scripts": { "prepush": "yarn build; yarn danger:prepush", "danger:prepush": "yarn danger local --dangerfile dangerfile.lite.ts" // [...]
You'll need to have husky installed for this to work. - @orta
- STDOUT formatting has been improved, which is the terminal only version of Danger's typical GitHub comment style
system. It's used in
danger pr
,danger ci --stdout
anddanger local
. - @orta - Exposed a get file contents for the platform abstraction so that Peril can work on many platforms in the future - @orta
- Paginate for issues - @orta
- Added support for Nevercode.io as a CI Provider - @fbartho
- Don't log ENV vars during a run - thanks @samdmarshall. - @orta
- Bug fixes and debug improvements. If you're interested run danger with
DEBUG="*" yarn danger [etc]
and you'll get a lot of output. This should make it much easier to understand what's going on. - @orta
-
Updates to the CLI user interface. Breaking changes for everyone.
TLDR - change
yarn danger
toyarn danger ci
.Danger JS has been fighting an uphill battle for a while with respects to CLI naming, and duplication of work. So, now it's been simplified. There are four user facing commands:
danger init
- Helps you get started with Dangerdanger ci
- Runs Danger on CIdanger process
- Likeci
but lets another process handle evaluating a Dangerfiledanger pr
- Runs your local Dangerfile against an existing GitHub PR. Will not post on the PR
This release deprecates running
danger
on it's own, so if you haveyarn danger
then move that beyarn danger ci
.Each command name is now much more obvious in it intentions, I've heard many times that people aren't sure what 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 it a clean slate.
On a positive note, I gave all of the help screens an update and tried to improve language where I could.
- Fix to
danger pr
anddanger
infinite looping - @orta
- Fix Codeship integration - @caffodian
- Updates documentation dependencies - @orta
- Fixes to running
danger
with params - @orta - Fixes for
danger pr
not acting likedanger
WRT async code - @orta - Fixes
tsconfig.json
parse to be JSON5 friendly - [@gantman] - Fixes for
danger.github.thisPR
to use the base metadata for a PR, I'm too used to branch workflows - @orta
- Updates dependencies - @orta
- Link to the build URL if Danger can find it in the CI env - @orta
- Removes the "couldn't post a status" message - @orta
- The TS compiler will force a module type of commonjs when transpiling the Dangerfile - @orta
- Adds a CLI option for a unique Danger ID per run to
danger
anddanger process
, so you can have multiple Danger comments on the same PR. - @orta
- Fixes/Improvements for
danger init
- @orta
- Adds a new command for getting set up:
danger init
- @orta - Fix double negative in documentation. @dfalling
- Fix
gloabally
typo in documentation. @dfalling
- Adds a warning when you try to import Danger when you're not in a Dangerfile - @orta
- Exports the current process env to the
danger run
subprocess - @orta
- Potential fixes for CLI sub-commands not running when packaging danger - @orta
- Fixes the
danger.js.flow
fix to handle exports correctly, you probably need to add.*/node_modules/danger/distribution/danger.js.flow
to the[libs]
section of your settings for it to work though - @orta
- Fixes a bug with
danger.github.utils
in that it didn't work as of b1, and now it does 👍 - @orta - Ships a
danger.js.flow
in the root of the project, this may be enough to support flow typing, thanks to @joarwilk and flowgen - @orta
-
Converts the command
danger
(anddanger run
) to usedanger process
under the hood. What does this do?-
Dangerfile evaluation is in a separate process, run without a vm sandbox. This fixes the async problem which we created
schedule
for. Previously, any async work in your Dangerfile needed to be declared to Danger so that it knew when all of the work had finished. Now that the running happens inside another process, we can use theon_exit
calls of the process to know that all work is done. So, in Danger (not in Peril) async code will work just like inside a traditional node app. -
Makes
danger process
a first class citizen. This is awesome because there will be reliable support for other languages like danger-swift, danger-go and more to come. -
The
danger process
system is now codified in types, so it's really easy to document on the website.
-
-
Adds a
--js
and--json
option todanger pr
which shows the output in a way that works withdanger process
. This means you can preview the data for any pull request.
./@orta
Moves away from vm2 to a require-based Dangerfile runner. This removes the sandboxing aspect of the Dangerfile completely, but the sandboxing was mainly for Peril and I have a plan for that.
I 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
alpha for a bit more. One interesting side-effect of this could be that I can remove schedule
from the DSL. I've not
tested it yet though. Turns out this change is real hard to write tests for. I've made #394 for that.
./@orta
- Moves internal methods away from Sync to avoid problems when running in Peril - @ashfurrow
- Passes through non-zero exit codes from
danger process
runs - @ashfurrow
- Improve CircleCI PR detection
Some UX fixes:
- Don't show warnings about not setting a commit status (unless in verbose) - @orta
- Delete duplicate Danger message, due to fast Peril edits - @orta
- Show Peril in the commit status if inside Peril, not just Danger - @orta
- [internal] Tightened the typings on the commands, and abstracted them to share some code - @orta
- Updates
diffForFile
,JSONPatchForFile
, andJSONDiffForFile
to include created and removed files - #368 - [@bdotdub]
- Adds a blank project generated in travis 8 to test no-babel or TS integration - @orta
- Improvements to
danger process
logging, and build fails correctly #363 - @orta
- Improve the error handling around the babel API - #357 - @orta
- Move back to the original URLs for diffs, instead of relying on PR metadata - @orta
- Updates the types for
schedule
to be more accepting of what it actually takes - @orta
- Fixed #348 invalid json response body error on generating a diff - felipesabino
- Potential fix for ^ that works with Peril also - @orta
- Doh, makes the
danger process
command actually available via the CLI - @orta
-
Adds a
danger process
command, this command takes amn argument of a process to run which expects the Danger DSL as JSON in STDIN, and will post a DangerResults object to it's STDOUT. This frees up another process to do whatever they want. So, others can make their own Danger runner.An example of this is Danger Swift. It takes a JSON document via STDIN, compiles and evaluates a Swift file then passes the results back to
danger process
via STDOUT.Another example is this simple Ruby script:
#!/usr/bin/env ruby require 'json' dsl_json = STDIN.tty? ? 'Cannot read from STDIN' : $stdin.read danger = JSON.parse(dsl_json) results = { warnings: [], messages:[], fails: [], markdowns: [] } if danger.github.pr.body.include? "Hello world" results.messages << { message: "Hey there" } end require 'json' STDOUT.write(results.to_json)
Which is basically Ruby Danger in ~10LOC. Lols.
This is the first release of the command, it's pretty untested, but it does work. - @orta
-
Uses the Babel 7 alpha for all source compilation with JS, Flow+JS and TS. This worked without any changes to our 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 happy to keep Danger in a pretty long alpha, till at least Babel 7 is in beta.
It also still supports using TypeScript via the "
typescript"
module, if you have that installed. - @orta -
danger.github.thisPR
now uses the PR's head, not base - @orta
- Uses the GitHub
diff_url
instead of thediff
version header, as it conflicted with Peril - @orta - Handle exceptions in Dangerfile and report them as failures in Danger results - [@macklinu]
- Expose a Promise object to the external GitHub API - @orta
- Allow running a dangerfile entirely from memory using the
Executor
API - @orta
- Removes the
jest-*
dependencies - @orta
-
Support a vm2 based Dangerfile runner as an alternative to the jest infrastructure. There are a few main reasons for this:
-
I haven't been able to completely understand how Jest's internals work around all of the code-eval and pre-requisite setup, which has made it hard to work on some more complex Peril features.
-
Jest releases are every few months, personally I love this as a user of Jest, as an API consumer it can be difficult to get changes shipped.
-
The fact that both Danger/Jest make runtime changes means that you need to update them together
-
I have commit access to vm2, so getting changes done is easy
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 where I'll have to add a bunch of new tools to get everything working.
The massive downside to this is that Danger now has to have support for transpiling via Babel, or from TypeScript unlike before, where it was a freebie inside Jest. Jest handled this so well. This means that a Dangerfile which used to "just work" with no config may not. Thus, IMO, this is a breaking major semver.
Is it likely that you need to make any changes? So far, it seems probably not. At least all of the tests with Dangerfiles original from the older Jest runner pass with the new version.
This is an alpha release, because it's knowingly shipped with some breakages around babel support, specifically:
- Babel parsing of relative imports in a Dangerfile aren't working
- Some of the features which require the
regeneratorRuntime
to be set up aren't working yet
Those are blockers on a 2.0.0 release.
-
-
Exposes an internal API for reading a file from a GitHub repo as
danger.github.utils.fileContents
- @ortaIdeally this is what you should be using in plugins to read files, it's what Danger uses throughout the codebase internally. This means that your plugin/dangerfile doesn't need to rely on running on the CI when instead it could run via the GitHub API.
-
Update prettier - @orta
-
Removes dtslint as a dependency - sapegin/orta
- Support retrieve paginated pull request commit list - [@kwonoj]
- Add support for VSTS CI - [@mlabrum]
- Remove the DSL duplication on the
danger
export, it wasn't needed or used. - @orta - Update to TypeScript 2.4.x - @orta
- Rename github test static_file to remove
:
from the filename to fix a checkout issue on windows - [@mlabrum]
Hello readers! This represents a general stability for Danger. It is mainly a documentation release, as it corresponds to http://danger.systems/js/ being generally available. I made the initial commit back in 20 Aug 2016 and now it's 30th June 2017. It's awesome to look back through the CHANGELOG and see how things have changed.
You can find out a lot more about the 1.0, and Danger's history on my Artsy blog post on the Danger 1.0.
- Adds inline docs for all CI providers - @orta
- Use HTTP for the GitHub status check target URL - macklinu
- Correct some examples in node-app - clintam
- Add support for buddybuild CI - benkraus/clintam
- Add support for GithHub Apps API (no GET /user) - clintam
- Posts status reports for passing/failing builds, if the account for danger has access - @orta
- Adds prettier to the codebase - @orta
- Converts a bunch of Danger's dangerfile into a plugin - danger-plugin-yarn - @orta
This is my first non-trivial plugin, based on infrastructure from @macklinu. Plugins are looking great, you can get some info at https://github.com/macklinu/generator-danger-plugin.
- Docs updates for the website - @orta
- Fix
danger pr
commands are not running on windows - kwonoj - Fix broken link in getting started docs - frozegnome
- Do not delete comment written from user have same userid for danger - kwonoj
- Fix link to
jest
in getting started docs - palleas - Fix yarn install instruction in getting started docs - palleas
- Update to Jest 20 - macklinu
- Change the danger.d.ts to use module exports instead of globals - @orta
- Render markdown inside
message()
,warn()
, andfail()
messages. - macklinu
An example:
fail(`Missing Test Files:
- \`src/lib/components/artist/artworks/__tests__/index-tests.tsx\`
- \`src/lib/components/artwork_grids/__tests__/infinite_scroll_grid-tests.tsx\`
- \`src/lib/containers/__tests__/works_for_you-tests.tsx\`
If these files are supposed to not exist, please update your PR body to include "Skip New Tests".`)
Will result in:
Fails | |
---|---|
🚫 | Missing Test Files:
If these files are supposed to not exist, please update your PR body to include "Skip New Tests". |
-
Adds
github.api
. This is a fully authenticated client from the github npm module. - @ortaAn easy example of it's usage would be using Danger to add a label to your PR. Note that Danger will have the permissions for your account, so for OSS repos - this won't work.
danger.github.api.issues.addLabels({ owner: "danger", repo: "danger-js", number: danger.github.pr.number, labels: ["Danger Passed"], })
Yeah, that's a bit verbose, I agree. So, there's also
github.thisPR
which should simplify that. It aims to provide a lot of the values for the current PR to use with the API.const github = danger.github github.api.issues.addLabels({ ...github.thisPR, labels: ["Danger Passed"] })
You could use this API for a bunch of things, here's some quick ideas:
- Request specific reviewers when specific files change (
api.pullRequests.createReviewRequest
) - Add a label for when something passes or fails (
api.issues.addLabels
) - Verifying if someone is in your org? (
api.orgs.checkMembership
) - Updating Project tickets to show they have a PR (
api.projects.updateProject
)
- Request specific reviewers when specific files change (
-
Enhancements to
danger.git.diffForFile()
- @namuol- Removed
diffTypes
second argument in favor ofresult.added
andresult.removed
- Added
result.before
andresult.after
for easy access to full contents of the original & updated file danger.git.diffForFile
is now anasync
function
// In danger 0.16.0: const fullDiff = danger.git.diffForFile("foo.js") const addedLines = danger.git.diffForFile("foo.js", ["add"]) const removedLines = danger.git.diffForFile("foo.js", ["del"]) // In the latest version: const diff = await danger.git.diffForFile("foo.js") const fullDiff = diff.diff const addedLines = diff.added const removedLines = diff.removed const beforeFileContents = diff.before const afterFileContents = diff.after
- Removed
-
Update internal test fixture generation docs - namuol
- Adds a
diffTypes
option todiffForFile
- alex3165 - Add Buildkite CI source - jacobwgillespie
- When a Dangerfile fails to eval, send a message to the PR - @orta
-
Updated jest-* dependencies to 19.x - @orta
Updating the jest-* dependencies seems to be exhibiting strange behavior in tests for windows if you update, and use windows, can you please confirm that everything is 👍
-
Added type shapings to
JSONPatchForFile
- @orta -
Replaced deprecated
lodash.isarray
package withArray.isArray
- damassi
- Moved
@types/chalk
from dependencies to devDependencies - @orta - Killed some stray console logs - @orta
- Updated the danger.d.ts - @orta
-
TypeScript Dangerfiles are now support in Danger - @orta
We use TypeScript in Danger, and a lot of my work in Artsy now uses TypeScript (see: JS2017 at Artsy), so I wanted to explore using TypeScript in Dangerfiles.
This is built on top of Jest's custom transformers, so if you are already using Jest with TypeScript, then you can change the
dangerfile.js
todangerfile.ts
and nothing should need changing ( except that you might have new warnings/errors ) (note: in changing this for Danger, I had to also add thedangerfile.ts
to the"exclude"
section of thetsconfig.json
so that it didn't change the project's root folder.)This repo is now using both a babel Dangerfile (running on Circle CI) and a TypeScript one (running on Travis) to ensure that we don't accidentally break either.
-
Created a new
danger.d.ts
for VS Code users to get auto-completion etc - @orta -
Added a two new
git
DSL functions:git.JSONDiffForFile(filename)
andgit.JSONPatchForFile(filename)
.-
git.JSONPatchForFile
This will generate a rfc6902 JSON patch between two files inside your repo. These patch files are useful as a standard, but are pretty tricky to work with in something like a Dangerfile, where rule terseness takes priority.
-
git.JSONDiffForFile
This uses
JSONPatchForFile
to generate an object that represents all changes inside a Dangerfile as a single object, with keys for the changed paths. For example with a change like this:{ "dependencies": { "babel-polyfill": "^6.20.0", + "chalk": "^1.1.1", "commander": "^2.9.0", "debug": "^2.6.0" }, }
You could become aware of what has changed with a Dangerfile in a
schedule
'd function like:const packageDiff = await git.JSONDiffForFile("package.json") if (packageDiff.dependencies) { const deps = packageDiff.dependencies deps.added // ["chalk"], deps.removed // [] deps.after // { "babel-polyfill": "^6.20.0", "chalk": "^1.1.1", "commander": "^2.9.0", "debug": "^2.6.0" } deps.before // { "babel-polyfill": "^6.20.0", "commander": "^2.9.0", "debug": "^2.6.0" } }
The keys:
added
andremoved
only exist on the object if:before
andafter
are both objects - in which caseadded
andremoved
are the added or removed keysbefore
andafter
are both arrays - in which caseadded
andremoved
are the added or removed values
-
-
Exposed all global functions ( like
warn
,fail
,git
,schedule
, ... ) on thedanger
object. - @ortaThis is specifically to simplify building library code. It should not affect end-users. If you want to look at making a Danger JS Plugin, I'd recommend exposing a function which takes the
danger
object and working from that. If you're interested, there is an active discussion on plugin support in the DangerJS issues. -
Improves messaging to the terminal - @orta
-
Adds the ability to not have Danger post to GitHub via a flag:
danger run --text-only
- @orta -
Fix a crasher with
prs.find
#181 - @orta
-
Add
danger.utils
DSL, which includesdanger.utils.href()
anddanger.utils.sentence()
- macklinuWe were finding that a lot of Dangerfiles needed similar functions, so we've added a
utils
object to offer functions 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 you shouldn't need to use anything but Danger + utils to write your Dangerfiles.danger.utils.href("http://danger.systems", "Danger") // <a href="http://danger.systems">Danger</a> danger.utils.sentence(["A", "B", "C"]) // "A, B and C"
-
Adds
danger.github.utils
- which currently has only one function:fileLinks
- @ortaMost of the time people are working with a list of files (e.g. modified, or created) and then want to present clickable links to those. As the logic to figure the URLs is very GitHub specific, we've moved that into it's own object with space to grow.
const files = danger.git.modified_files // ["lib/component/a.ts", "lib/component/b.ts"] const links = danger.github.utils.fileLinks(files) // "<a href='...'>a</a> and <a href='...'>b</a>" warn(`These files have changes: ${links}`)
- Add support for Drone - gabro
-
Added support for handling async code in a Dangerfile - deecewan
This is still a bit of a work in progress, however, there is a new function added to the DSL:
schedule
.A Dangerfile is evaluated as a script, and so async code has not worked out of the box. With the
schedule
function you can now register a section of code to evaluate across multiple tick cycles.schedule
currently handles two types of arguments, either a promise or a function with a resolve arg. Assuming you have a working Babel setup for this inside your project, you can run a Dangerfile like this:schedule(async () => { const thing = await asyncAction() if (thing) { warn("After Async Function") } })
Or if you wanted something simpler,
schedule(resolved => { if (failed) { fail("Failed to run") } })
-
Adds new GitHub DSL elements - deecewan
danger.github.issue
- As a PR is an issue in GitHub terminology, the issue contains a bit more metadata. Mainly labels, so if you want to know what labels are applied to a PR, usedanger.github.issue.labels
danger.github.reviews
- Find out about your reviews in the new GitHub Reviewer systems,danger.github.requested_reviewers
- Find out who has been requested to review a PR.
- Updated TypeScript and Jest dependencies - @orta
- Add support for Github Enterprise via DANGER_GITHUB_API_BASE_URL env var - mashbourne
-
Internal changes for usage with Peril - @orta
-
Add
danger pr --repl
, which drops into a Node.js REPL after evaluating the dangerfile - macklinu -
Add support for Codeship - deecewan
- Add support for Docker Cloud - camacho
- Builds which only use markdown now only show the markdown, and no violations table is shown - mxstbr
- Adds support for running Danger against a PR locally - @orta
The workflow is that you find a PR that exhibits the behavior you'd like Danger to run against, then edit the local
Dangerfile.js
and run yarn run danger pr https://github.com/facebook/jest/pull/2629
.
This will post the results to your console, instead of on the PR itself.
- Danger changes to your Dangerfile are not persisted after the run - @orta
- Add summary comment for danger message - kwonoj
- Add
jest-environment-node
to the Package.json - @orta
-
Adds support for
git.commits
andgithub.commits
- @ortaWhy two? Well github.commits contains a bunch of github specific metadata ( e.g. GitHub user creds, commit comment counts. ) Chances are, you're always going to use
git.commits
however if you want more rich data, the GitHub one is available too. Here's an example:
const merges = git.commits.filter(commit => commit.message.include("Merge Master"))
if (merges.length) {
fail("Please rebase your PR")
}
- Support custom dangerfile via
-d
commandline arg - kwonoj - Allow debug dump output via
DEBUG=danger:*
environment variable - kwonoj - Adds surf-build ci provider - kwonoj
- Forward environment variables to external module constructor - kwonoj
- Support
danger run -ci
to specify external CI provider - kwonoj - Adds
--verbose
todanger
, which for now will echo out all the URLs Danger has requested - @orta - Migrate codebase into TypeScript from flow - kwonoj
- Handle removing all sorts of import types for Danger in the Dangerfile - @orta
- A failing network request will raise an error - @orta
- Fix Dangerfile parsing which broke due to Peril related changes - @orta
- Tweak the npmignore, ship less random stuff to others - @orta
- Fixes to the shipped Flow/TS definitions - @orta
- Adds more functions the the internal Danger GitHub client - @orta
- Infrastructure work to allow Peril to run a Dangerfile - @orta
- Upgrade outdated ESLint packages - macklinu
- Enhance Windows OS compatibility - kwonoj
- Set exit code to 1 when running
danger
throws an error - macklinu - Add Jenkins CI source - macklinu
- Add .editorconfig - macklinu
- Adds jest-runtime to the dependencies - @orta
-
You can build and run in vscode using your own custom
env/development.env
file. This is useful because you can use the debugger against a real PR. Seeenv/development.env.example
for syntax. - @orta -
Uses
jest-transform
andjest-runtime
to eval and apply babel transforms.This does two things, makes it feasible to do hosted-danger and makes it possible to write your Dangerfile in a way that's consistent with the rest of your JavaScript. - @orta
-
Add tests directory to .npmignore - macklinu
-
Update to Jest 18 - macklinu
- Brings back the ability to emulate a fake CI run locally via
danger
- @orta
- Makes
babel-polyfill
a direct dependency, this is because it is actually an implicit dependency in the app. I'm not 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 with it. - @orta
- Ship flow annotations with the npm module - @orta
- Adds more node instances to travis - romanki + orta
- Adds support for Semaphore CI - @orta
- The env vars
DANGER_TEST_REPO
andDANGER_TEST_PR
will allow you initialize the FakeCI with a repo of your choice. See README.md for more info - Improved error messaging around not including a
DANGER_GITHUB_API_TOKEN
in the ENV - nsfmc / orta - Adds support for getting the diff for a specific file from git: e.g.
// Politely ask for their name on the entry too
const changelogDiff = danger.git.diffForFile("changelog.md")
const contributorName = danger.github.pr.user.login
if (changelogDiff && changelogDiff.indexOf(contributorName) === -1) {
warn("Please add your GitHub name to the changelog entry, so we can attribute you.")
}
- Does not break commonmark on GitHub - @orta
- upgrades to flow 0.35.0 and fixes associated type errors in covariant/invariant interfaces - nsfmc
- omits flow requirement for new test files - nsfmc
- adds support for circleci - nsfmc
- defines CISource properties in flow as read-only - nsfmc
danger.pr
->danger.github.pr
, I've also created interfaces for them - @ortawarn
,message
,markdown
are all ported over to DangerJS - @orta- Shows a HTML table for Danger message - @orta
- Now offers a Flow-typed definition file, it's not shipped to their repo yet, you can make it by
npm run export-flowtype
- @orta - Started turning this into a real project by adding tests - @orta
- Changes some files cashing, added some logs, a bit of error reporting, and verifying everything works through npm - @orta
- Danger edit an existing post, and delete it when it's not relevant - @orta
- Danger will post a comment on a GitHub PR with any Fails - @orta
OK, first usable for others version. Only supports GitHub and Travis CI.
You can run by doing:
danger
Make sure you set a DANGER_GITHUB_API_TOKEN
on your CI -
see the Ruby guide for that.
Then you can make a dangerfile.js
(has to be lowercase, deal with it.) It has access to a whopping 2 DSL attributes.
pr
git
fail(message: string)
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
that. It's the full metadata of the PR, so
this JSON file.
git
currently has:
git.modified_file
git.created_files
git.deleted_files
which are string arrays of files.
fail(message: string)
will let you raise an error, and will make the process return 1 after the parsing has finished.
Overall: your Dangerfile should look something like:
import { danger } from "danger"
const hasChangelog = danger.git.modified_files.includes("changelog.md")
if (!hasChangelog) {
fail("No Changelog changes!")
}
That should do ya. I think. This doesn't support babel, and I haven't explored using other modules etc, so...
./@orta
Not usable for others, only stubs of classes etc. - @orta