Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot
2025-04-24 09:10:10 +00:00
parent 37ae177a1b
commit b39f7ccba1
114 changed files with 1064 additions and 843 deletions

View File

@ -3,7 +3,10 @@
module CI
class ChangedFiles
FRONTEND_FILES_FILTER = /\.(js|cjs|mjs|vue)$/
FRONTEND_EXTENSIONS = "js|cjs|mjs|vue|graphql"
FRONTEND_FILES_FILTER = /\.(#{FRONTEND_EXTENSIONS})$/
ESLINT_TODO_FILES = %r{\.eslint_todo/[a-z-]+\.mjs$}
ESLINT_TODO_REMOVED_FILE_PATHS = %r{- +'([a-z/_-]+\.(#{FRONTEND_EXTENSIONS}))'}
def initialize(env: ENV, args: ARGV)
@env = env
@ -18,6 +21,15 @@ module CI
`git diff --name-only --diff-filter=d HEAD~..HEAD`.split("\n")
end
def get_files_removed_from_todo_files(changed_files)
changed_todo_files = changed_files.filter { |file| file =~ ESLINT_TODO_FILES }
return [] if changed_todo_files.empty?
diff = `git diff HEAD~..HEAD -- #{changed_todo_files.join(' ')}`
diff.scan(ESLINT_TODO_REMOVED_FILE_PATHS).map(&:first)
end
def filter_and_get_changed_files_in_mr(filter_pattern: //)
get_changed_files_in_merged_results_pipeline.grep(filter_pattern)
end
@ -26,6 +38,7 @@ module CI
puts 'Running ESLint for changed files...'
files = filter_and_get_changed_files_in_mr(filter_pattern: FRONTEND_FILES_FILTER)
files += get_files_removed_from_todo_files(files)
if files.empty?
puts 'No files were changed. Skipping...'