Skip to content

Commit 0953025

Browse files
added dangerfile
1 parent 8ef528f commit 0953025

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

Dangerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
skip_danger_check = github.pr_body.include? "#skip_danger"
2+
3+
if skip_danger_check
4+
message("Skipping Danger due to skip_danger tag")
5+
return
6+
end
7+
8+
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet.
9+
if github.pr_json["mergeable_state"] == "draft"
10+
message("Skipping Danger since PR is classed as Draft")
11+
return
12+
end
13+
14+
# Warn when there is a big PR.
15+
warn("Big PR") if git.lines_of_code > 500
16+
17+
# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title.
18+
if github.pr_body.length < 3 && git.lines_of_code > 50
19+
warn("Please provide a summary in the Pull Request description")
20+
end
21+
22+
## Let's check if there are any changes in the project folder
23+
has_app_changes = !git.modified_files.grep(/Sources/).empty?
24+
25+
## Then, we should check if tests are updated
26+
# has_test_changes = !git.modified_files.grep(/StreamChatCoreTests/).empty?
27+
28+
# if has_app_changes && !has_test_changes
29+
# warn("Please adds tests!")
30+
# end
31+
32+
has_meta_label = github.pr_labels.any? { |label| label.include? "meta" }
33+
has_demo_label = github.pr_labels.any? { |label| label.include? "demo" }
34+
has_no_changelog_tag = github.pr_body.include? "#no_changelog"
35+
has_skip_changelog_tag = github.pr_body.include? "#skip_changelog"
36+
37+
has_changelog_escape = has_meta_label || has_demo_label || has_no_changelog_tag || has_skip_changelog_tag
38+
39+
# Add a CHANGELOG entry for app changes
40+
if !has_changelog_escape && !git.modified_files.include?("CHANGELOG.md") && has_app_changes
41+
message("There seems to be app changes but CHANGELOG wasn't modified.\nPlease include an entry if the PR includes user-facing changes.\nYou can find it at [CHANGELOG.md](https://github.com/GetStream/stream-chat-swift/blob/main/CHANGELOG.md).")
42+
end
43+
44+
# Check all commits have correct format. Disable the length rule, since it's hardcoded
45+
# to 50 and GitHub has the limit 80.
46+
commit_lint.check disable: [:subject_length]

fastlane/Fastfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ end
7575
desc "Runs tests in Debug config"
7676
lane :test_ui do |options|
7777

78-
setCIEnvironmentVariable("../Tests/StreamChatUITests/StreamChatSwiftUI.xctestplan")
78+
setCIEnvironmentVariable("../StreamChatUITests/Tests/StreamChatSwiftUI.xctestplan")
7979

8080
scan(
8181
project: "StreamChatSwiftUI.xcodeproj",

0 commit comments

Comments
 (0)