-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial Danger setup with Dangermattic
- Loading branch information
Showing
6 changed files
with
175 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash -eu | ||
|
||
export DANGER_GITHUB_API_TOKEN=${GITHUB_TOKEN} | ||
|
||
echo "--- :rubygems: Setting up Gems" | ||
bundle install | ||
|
||
echo "--- Running Danger: PR Check" | ||
bundle exec danger --fail-on-errors=true --dangerfile=.buildkite/danger/Dangerfile --remove-previous-comments --danger_id=pr-check |
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,39 @@ | ||
# frozen_string_literal: true | ||
|
||
def release_branch? | ||
danger.github.branch_for_base.start_with?('release/') || danger.github.branch_for_base.start_with?('hotfix/') | ||
end | ||
|
||
def main_branch? | ||
danger.github.branch_for_base == 'develop' || danger.github.branch_for_base == 'trunk' || danger.github.branch_for_base == 'main' | ||
end | ||
|
||
def wip_feature? | ||
has_wip_label = github.pr_labels.any? { |label| label.include?('WIP Feature') || label == 'WIP' } | ||
has_wip_title = github.pr_title.include?('[WIP]') | ||
|
||
has_wip_label || has_wip_title | ||
end | ||
|
||
# if we have a shared Dangerfile, we can import it here | ||
# danger.import_dangerfile(gem: 'danger-dangermattic') | ||
|
||
return if github.pr_labels.include?('Releases') | ||
|
||
manifest_pr_checker.check_gemfile_lock_updated | ||
labels_checker.check( | ||
required_labels: [//], | ||
required_labels_error: 'PR is missing at least one label.' | ||
) | ||
view_changes_need_screenshots.view_changes_need_screenshots | ||
pr_size_checker.check_diff_size( | ||
file_selector: ->(path) { !path.include?('/src/test') }, | ||
max_size: 300 | ||
) | ||
android_unit_test_checker.check_missing_tests | ||
|
||
# skip for draft PRs and for wip features unless the PR is against "develop" or "release/x.x" branches | ||
milestone_checker.check_milestone_due_date(days_before_due: 4) if !github.pr_draft? && (!wip_feature? || (release_branch? || main_branch?)) | ||
|
||
github.dismiss_out_of_range_messages | ||
rubocop.lint inline_comment: true, fail_on_inline_comment: true, include_cop_names: true |
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,20 @@ | ||
inherit_mode: | ||
merge: | ||
- Include | ||
|
||
AllCops: | ||
Exclude: | ||
- vendor/**/* | ||
Include: | ||
- .buildkite/danger/**/* | ||
NewCops: enable | ||
|
||
Metrics/MethodLength: | ||
Max: 30 | ||
|
||
Layout/LineLength: | ||
Max: 180 | ||
|
||
Naming/FileName: | ||
Exclude: | ||
- .buildkite/danger/Dangerfile |
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