gitlab-dangerfiles 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger/helper.rb +10 -11
- data/lib/gitlab/dangerfiles/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 133950a9ab88093e18c6e394cadb8047a9975cd12b3f2cdec9167b07ca6677ff
|
4
|
+
data.tar.gz: fde2b4a7c3c0639fbc4682447b655bb9dfc16fd3a1e616fd54aad48c117856de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55f2fb30261069530f151eef6396346abd7769fe0fdfde7b5e9f81a15aa70d81ba9ff63d3981b4aed62154563fefdfb0df9a12e39e2ed33a011c8315f372906f
|
7
|
+
data.tar.gz: b4abb0b2a90c088cd5a499b35ab2cc99dcbb579f61a0839056a8b8d910134e0cda0b5d1b5323a975fb48fa0afa5e8d86b4ea5cdc01317725e5e4893bd2658b83
|
data/lib/danger/helper.rb
CHANGED
@@ -9,6 +9,7 @@ module Danger
|
|
9
9
|
# Common helper functions for our danger scripts.
|
10
10
|
class Helper < Danger::Plugin
|
11
11
|
RELEASE_TOOLS_BOT = "gitlab-release-tools-bot"
|
12
|
+
DRAFT_REGEX = /\A*#{Regexp.union(/(?i)(\[WIP\]\s*|WIP:\s*|WIP$)/, /(?i)(\[draft\]|\(draft\)|draft:|draft\s\-\s|draft$)/)}+\s*/i.freeze
|
12
13
|
CATEGORY_LABELS = {
|
13
14
|
docs: "~documentation", # Docs are reviewed along DevOps stages, so don't need roulette for now.
|
14
15
|
none: "",
|
@@ -110,7 +111,9 @@ module Danger
|
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
113
|
-
# Determines the categories a file is in, e.g., `[:frontend]`, `[:backend]`, or `%i[frontend engineering_productivity]
|
114
|
+
# Determines the categories a file is in, e.g., `[:frontend]`, `[:backend]`, or `%i[frontend engineering_productivity]`
|
115
|
+
# using filename regex and specific change regex if given.
|
116
|
+
#
|
114
117
|
# @return Array<Symbol>
|
115
118
|
def categories_for_file(file, categories)
|
116
119
|
_, categories = categories.find do |key, _|
|
@@ -137,20 +140,16 @@ module Danger
|
|
137
140
|
usernames.map { |u| Gitlab::Dangerfiles::Teammate.new("username" => u) }
|
138
141
|
end
|
139
142
|
|
140
|
-
def missing_database_labels(current_mr_labels)
|
141
|
-
labels = if has_database_scoped_labels?(current_mr_labels)
|
142
|
-
["database"]
|
143
|
-
else
|
144
|
-
["database", "database::review pending"]
|
145
|
-
end
|
146
|
-
|
147
|
-
labels - current_mr_labels
|
148
|
-
end
|
149
|
-
|
150
143
|
def sanitize_mr_title(title)
|
151
144
|
title.gsub(/^WIP: */, "").gsub(/`/, '\\\`')
|
152
145
|
end
|
153
146
|
|
147
|
+
def draft_mr?
|
148
|
+
return false unless gitlab_helper
|
149
|
+
|
150
|
+
DRAFT_REGEX.match?(gitlab_helper.mr_json["title"])
|
151
|
+
end
|
152
|
+
|
154
153
|
def security_mr?
|
155
154
|
return false unless gitlab_helper
|
156
155
|
|