Supports GitHub, GitLab, and Bitbucket Cloud.
https://medium.com/p/8c61e402cd4e
- Install Danger JS
$ npm install -g danger
- Activate Danger Dart
$ pub global activate danger_dart
- Adding
danger_core
todev_dependencies
dev_dependencies:
danger_core:
- Create
dangerfile.dart
import 'package:danger_core/danger_core.dart';
void main() {
if (danger.github.pr.title.contains('WIP')) {
warn('PR is considered WIP');
}
}
For GitHub, you need DANGER_GITHUB_API_TOKEN
in your environment variable, can be created here.
For Bitbucket Cloud, please refer to https://danger.systems/js/usage/bitbucket_cloud.html
For GitLab, please refer to https://danger.systems/js/usage/gitlab.html
danger_dart ci
- Use this on CIdanger_dart pr https://github.com/Moya/Harvey/pull/23
- Use this to build your Dangerfiledanger_dart local
- Use this to run danger against your local changes from master
For GithubAction, you need to set GITHUB_TOKEN as environment example
- name: Run danger ci
run: danger_dart ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Check the Debugging doc.
We can use pub global activate
to enable command danger_dart
.
$ pub global activate --source path packages/danger_dart/
Or using dart
to run directly.
$ dart packages/danger_dart/bin/danger_dart.dart ci
$ dart packages/danger_dart/bin/danger_dart.dart pr https://github.com/Moya/Harvey/pull/23
$ dart packages/danger_dart/bin/danger_dart.dart local
You can create your own plugin using command
$ dart create -t package-simple <plugin_name>
In pubspec.yaml
put danger_core
in dependences
dependencies:
danger_core:
For more information, see the example https://github.com/danger/dart/tree/master/packages/danger_plugin_dart_test