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

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2021-02-05 12:17:36 +0300
committerAchilleas Pipinellis <axil@gitlab.com>2021-02-05 12:35:43 +0300
commit4f6638affa46de8bcfae368fafa920fc8c070e2c (patch)
treea52efa32586a597de2a71ecfe20948b538cbf683 /Rakefile
parent9c372f7cbdba7b755161476dafc17c1130765878 (diff)
Symlink only listed READMEs to index.html
We need to only symlink the READMEs that are not redirected, in order to avoid redirect loops.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 15fc6b08..ecc08dfb 100644
--- a/Rakefile
+++ b/Rakefile
@@ -226,3 +226,31 @@ namespace :release do
end
end
end
+
+desc 'Symlink READMEs'
+task :symlink_readmes do
+ readmes = YAML.load_file('content/_data/readmes.yaml')
+ products.each_value do |product|
+ branch = retrieve_branch(product['slug'])
+
+ # Limit the pipeline to pull only the repo where the MR is, not all 4, to save time/space.
+ # First we check if the branch on the docs repo is other than the default branch and
+ # then we skip if the remote branch variable is the default branch name. Finally,
+ # check if the pipeline was triggered via the API (multi-project pipeline)
+ # to exclude the case where we create a branch right off the gitlab-docs
+ # project.
+ next if ENV["CI_COMMIT_REF_NAME"] != ENV['CI_DEFAULT_BRANCH'] && branch == ENV['CI_DEFAULT_BRANCH'] && ENV["CI_PIPELINE_SOURCE"] == 'pipeline'
+
+ next if readmes.key?(product['slug']) == false
+
+ readmes.fetch(product['slug']).each do |readme|
+ dirname = File.dirname(readme)
+ target = "#{dirname}/index.html"
+
+ next if File.symlink?(target)
+ puts "=> Symlink to #{target}"
+ `ln -sf README.html #{target}`
+ end
+ end
+end
+