Commit a3910bbe authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Check if pipelines for merge requests are enabled

This script is used to preview docs changes by deploying
review apps to the gitlab-docs project.

The branch name of the gitlab-docs project was taken from the
CI_MERGE_REQUEST_IID variable, which is only present if pipelines
for merge requests are enabled.

With this change, we check if that's the case, otherwise we set
a fallback to CI_COMMIT_REF_SLUG.
parent 436f47e2
...@@ -21,7 +21,13 @@ GITLAB_DOCS_REPO = 'gitlab-org/gitlab-docs'.freeze ...@@ -21,7 +21,13 @@ GITLAB_DOCS_REPO = 'gitlab-org/gitlab-docs'.freeze
# kicked the review app. # kicked the review app.
# #
def docs_branch def docs_branch
"docs-preview-#{slug}-#{ENV["CI_MERGE_REQUEST_IID"]}" # Check if CI_MERGE_REQUEST_IID is present. This requires pipelines
# for merge requests to be enabled.
if ENV["CI_MERGE_REQUEST_IID"].nil?
"docs-preview-#{slug}-#{ENV["CI_COMMIT_REF_SLUG"]}"
else
"docs-preview-#{slug}-#{ENV["CI_MERGE_REQUEST_IID"]}"
end
end end
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment