File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,14 +2,31 @@ name: Danger
22
33on :
44 pull_request :
5+ branches :
6+ - main
57
68jobs :
7- build :
9+ danger :
810 runs-on : ubuntu-latest
9- name : " Run Danger "
11+
1012 steps :
11- - uses : actions/checkout@v4
12- - name : Danger
13- uses : danger/kotlin@1.3.3
13+ - name : Checkout repository
14+ uses : actions/checkout@v4
15+
16+ - name : Set up Flutter
17+ uses : ./.github/actions/setup-flutter
18+
19+ - name : Install dependencies
20+ run : flutter pub get
21+ shell : bash
22+
23+ - name : Install Danger-js
24+ run : npm install -g danger
25+
26+ - name : Activate command
27+ run : flutter pub global activate danger_dart
28+
29+ - name : Run danger ci
30+ run : danger_dart ci
1431 env :
15- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
32+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1818
1919 - name : Generate Resources
2020 run : flutter gen-l10n
21-
21+
2222 - name : Run tests
2323 run : flutter test
2424
Original file line number Diff line number Diff line change 1+ import 'package:danger_core/danger_core.dart' ;
2+
3+ const bigPRThreshold = 300 ;
4+
5+ void main () {
6+ // WIP check
7+ if (danger.github.pr.title.contains ('WIP' )) {
8+ warn ('PR is considered WIP' );
9+ }
10+
11+ // Unit tests check
12+ final allSourceFiles = [
13+ ...danger.git.modifiedFiles,
14+ ...danger.git.createdFiles,
15+ ];
16+
17+ if (allSourceFiles.any ((file) => file.endsWith ('_test.dart' ))) {
18+ message ('Thanks for updating the unit tests' );
19+ }
20+
21+ // Big PR check
22+ final prAdditions = danger.github.pr.additions ?? 0 ;
23+ final prDeletions = danger.github.pr.additions ?? 0 ;
24+ final isBigPR = (prAdditions + prDeletions) > bigPRThreshold;
25+
26+ if (isBigPR) {
27+ warn ('Big PR, try to keep changes smaller if you can...' );
28+ }
29+ }
Original file line number Diff line number Diff line change @@ -217,6 +217,14 @@ packages:
217217 url: "https://pub.dev"
218218 source: hosted
219219 version: "1.0.8"
220+ danger_core:
221+ dependency: "direct dev"
222+ description:
223+ name: danger_core
224+ sha256: f949e126fcd0dcbd41ce973d733f2cb18426ee3870c0ec16ad331a2d9ce698c1
225+ url: "https://pub.dev"
226+ source: hosted
227+ version: "2.0.0"
220228 dart_style:
221229 dependency: transitive
222230 description:
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ dev_dependencies:
6262 injectable_generator : ^2.5.0
6363 build_runner : ^2.5.4
6464 auto_route_generator : ^10.1.0
65+ danger_core : ^2.0.0
6566
6667# For information on the generic Dart part of this file, see the
6768# following page: https://dart.dev/tools/pub/pubspec
You can’t perform that action at this time.
0 commit comments