summaryrefslogtreecommitdiff
path: root/tooling/bin/find_changes
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
commit0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch)
tree4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /tooling/bin/find_changes
parent744144d28e3e7fddc117924fef88de5d9674fe4c (diff)
downloadgitlab-ce-14.3.0-rc42.tar.gz
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'tooling/bin/find_changes')
-rwxr-xr-xtooling/bin/find_changes21
1 files changed, 21 insertions, 0 deletions
diff --git a/tooling/bin/find_changes b/tooling/bin/find_changes
new file mode 100755
index 00000000000..466510ccb19
--- /dev/null
+++ b/tooling/bin/find_changes
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+require 'gitlab'
+
+gitlab_token = ENV.fetch('DANGER_GITLAB_API_TOKEN', '')
+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(' '))