Welcome to mirror list, hosted at ThFree Co, Russian Federation.

find_changes « bin « tooling - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 20df085879aee29c12e668bcba1739c12d3722a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'gitlab'

gitlab_token = ENV.fetch('PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE', '')
gitlab_endpoint = ENV.fetch('CI_API_V4_URL')
mr_project_path = ENV.fetch('CI_MERGE_REQUEST_PROJECT_PATH')
mr_iid = ENV.fetch('CI_MERGE_REQUEST_IID')

output_file = ARGV.shift

Gitlab.configure do |config|
  config.endpoint       = gitlab_endpoint
  config.private_token  = gitlab_token
end

mr_changes = Gitlab.merge_request_changes(mr_project_path, mr_iid)
file_changes = mr_changes.changes.map { |change| change['new_path'] }

File.write(output_file, file_changes.join(' '))