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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-06 19:37:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-06 19:37:12 +0300
commitdbff55cb6962eb6209b1c4ced1cd79fb53607ebd (patch)
treeaeba24ed325e92d8f065804d910f57f265478be0 /scripts/api
parent637146034ce2a23df46d90b8e0b77d75553fdbb9 (diff)
Add latest changes from gitlab-org/gitlab@15-8-stable-ee
Diffstat (limited to 'scripts/api')
-rw-r--r--scripts/api/commit_merge_requests.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/api/commit_merge_requests.rb b/scripts/api/commit_merge_requests.rb
new file mode 100644
index 00000000000..3cf8dc87497
--- /dev/null
+++ b/scripts/api/commit_merge_requests.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require 'gitlab'
+require_relative 'default_options'
+
+class CommitMergeRequests
+ def initialize(options)
+ @project = options.fetch(:project)
+ @sha = options.fetch(:sha)
+
+ # If api_token is nil, it's set to '' to allow unauthenticated requests (for forks).
+ api_token = options.fetch(:api_token, '')
+
+ warn "No API token given." if api_token.empty?
+
+ @client = Gitlab.client(
+ endpoint: options.fetch(:endpoint, API::DEFAULT_OPTIONS[:endpoint]),
+ private_token: api_token
+ )
+ end
+
+ def execute
+ client.commit_merge_requests(project, sha)
+ end
+
+ private
+
+ attr_reader :project, :sha, :client
+end