-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'original/master' into file_line_api
- Loading branch information
Showing
51 changed files
with
381 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
[ignore] | ||
distribution | ||
.*/_tests/.* | ||
.*dangerfile.js | ||
node_modules/jest*/**/** | ||
.*/source/.* | ||
.*/node_modules/.* | ||
|
||
[include] | ||
dangerfile.flow.js | ||
|
||
[libs] | ||
flow-typed/ | ||
distribution/danger.js.flow | ||
|
||
[lints] | ||
|
||
[options] | ||
unsafe.enable_getters_and_setters=true | ||
|
||
[strict] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// This file isn't used anywhere, but it is used as a part of `yarn flow check` | ||
// to validate that flow typings work correctly for JS Dangerfiles | ||
|
||
// @flow | ||
|
||
import { danger } from "danger" | ||
|
||
danger.github.pr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
title: Danger + BitBucket Server | ||
subtitle: Dangerous bits | ||
layout: guide_js | ||
order: 4 | ||
blurb: An overview of using Danger with BitBucket Server, and some examples | ||
--- | ||
|
||
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 in your Dangerfiles you will have a fully fleshed out `danger.bitbucket_server` object to work with. For example: | ||
|
||
```ts | ||
import { danger, warn } from "danger" | ||
|
||
if (danger.bitbucket_server.pr.title.includes("WIP")) { | ||
warn("PR is considered WIP") | ||
} | ||
``` | ||
|
||
The DSL is expansive, you can see all the details inside the [Danger JS Reference][ref], | ||
but the TLDR is: | ||
|
||
```ts | ||
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[] | ||
``` | ||
|
||
Here are some example rules using the DSL: | ||
|
||
```ts | ||
import { danger, warn } from "danger" | ||
|
||
const bbs = danger.bitbucket_server | ||
|
||
// Ensure a PR has assigned Jira issues | ||
if (bbs.issues.length === 0) { | ||
warn("This PR does not have any assigned Jira issues.") | ||
} | ||
|
||
// Make a warning if there are changes to a package.json but that a | ||
// user called murphdog hasn't yet weighed in that the changes are fine. | ||
const hasPackageChanges = danger.git.modified_files.includes("package.json") | ||
const hasMurphDogApproval = bbs.comments.find( | ||
c => c.user.slug == "murphdog" && !!c.comment && c.comment.text.includes(":+1:") | ||
) | ||
if (hasPackageChanges && !hasMurphDogApproval) { | ||
warn("This PR has `package.json` changes, but @murphdog hasn't approved them yet.") | ||
} | ||
|
||
// Enforce team "fun" | ||
const hasGIF = bbs.pr.description.includes(".gif") | ||
if (hasGIF) { | ||
fail("This PR needs a GIF.") | ||
} | ||
``` | ||
|
||
Plus any other example you can find that uses GitHub, will probably work in BitBucket Server, with a bit of DSL translation. | ||
|
||
Our BitBucket Server support is still pretty new, so we'd love to see improvements and PRs to help make it work for everyone. |
Oops, something went wrong.