summaryrefslogtreecommitdiff
path: root/tooling
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-27 09:27:52 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-27 09:27:52 +0000
commit996683657578757cf42ef7478a5c3b9874b312f0 (patch)
treeadbc8884ee6f1fb381ea027fa8b51f68143c9dcf /tooling
parent3fbe43541ef99c27a9e4ab9c545ec0eb9bb50a9e (diff)
downloadgitlab-ce-996683657578757cf42ef7478a5c3b9874b312f0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'tooling')
-rwxr-xr-xtooling/bin/find_only_allowed_files_changes12
-rwxr-xr-xtooling/bin/find_only_js_changes12
-rwxr-xr-xtooling/lib/tooling/find_changes.rb6
3 files changed, 16 insertions, 14 deletions
diff --git a/tooling/bin/find_only_allowed_files_changes b/tooling/bin/find_only_allowed_files_changes
new file mode 100755
index 00000000000..c40048c66fa
--- /dev/null
+++ b/tooling/bin/find_only_allowed_files_changes
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+require_relative '../lib/tooling/find_changes'
+
+if Tooling::FindChanges.new(from: :api).only_allowed_files_changed
+ puts "Only files with extensions #{ALLOWED_FILE_TYPES.join(', ')} were changed"
+ exit 0
+else
+ puts "Changes were made to files with extensions other than #{ALLOWED_FILE_TYPES.join(', ')}"
+ exit 1
+end
diff --git a/tooling/bin/find_only_js_changes b/tooling/bin/find_only_js_changes
deleted file mode 100755
index a69ee64fe14..00000000000
--- a/tooling/bin/find_only_js_changes
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env ruby
-# frozen_string_literal: true
-
-require_relative '../lib/tooling/find_changes'
-
-if Tooling::FindChanges.new(from: :api).only_js_files_changed
- puts "Only JS files were changed"
- exit 0
-else
- puts "Changes were made to files other than JS files"
- exit 1
-end
diff --git a/tooling/lib/tooling/find_changes.rb b/tooling/lib/tooling/find_changes.rb
index 25381e1a894..c498c83d24b 100755
--- a/tooling/lib/tooling/find_changes.rb
+++ b/tooling/lib/tooling/find_changes.rb
@@ -8,6 +8,8 @@ module Tooling
class FindChanges
include Helpers::PredictiveTestsHelper
+ ALLOWED_FILE_TYPES = ['.js', '.vue', '.md', '.scss'].freeze
+
def initialize(
from:,
changed_files_pathname: nil,
@@ -41,8 +43,8 @@ module Tooling
end
end
- def only_js_files_changed
- file_changes.any? && file_changes.all? { |file| file.end_with?('.js') }
+ def only_allowed_files_changed
+ file_changes.any? && file_changes.all? { |file| ALLOWED_FILE_TYPES.include?(File.extname(file)) }
end
private