summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-18 11:11:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-18 11:11:44 +0000
commit25989ab7ef1a444ed2abd5479f176d58e1d9462a (patch)
tree271bb24f3c7178f320cb9de0be0833a285327d09 /scripts
parent9bbb32b29703f3ce33dd35d5101145774b793a6d (diff)
downloadgitlab-ce-25989ab7ef1a444ed2abd5479f176d58e1d9462a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update-feature-categories36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/update-feature-categories b/scripts/update-feature-categories
new file mode 100755
index 00000000000..ed5d8dccdd6
--- /dev/null
+++ b/scripts/update-feature-categories
@@ -0,0 +1,36 @@
+#!/usr/bin/env ruby
+
+require 'uri'
+require 'net/http'
+require 'yaml'
+
+url = URI("https://gitlab.com/gitlab-com/www-gitlab-com/raw/master/data/stages.yml")
+
+http = Net::HTTP.new(url.host, url.port)
+http.use_ssl = true
+
+request = Net::HTTP::Get.new(url)
+
+response = http.request(request)
+
+stages_doc = YAML.safe_load(response.read_body)
+feature_categories = stages_doc["stages"].values
+ .flat_map { |stage| stage["groups"].values }
+ .flat_map { |group| group["categories"] }
+ .select(&:itself)
+ .uniq
+ .sort
+
+File.open("#{__dir__}/../config/feature_categories.yml", 'w') do |file|
+ file.puts(<<~HEADER_COMMENT)
+ #
+ # This file contains a list of all feature categories in GitLab
+ # It is generated from the stages file at #{url}.
+ # If you would like to update it, please run
+ # `./scripts/update-feature-categories` to generate a new copy
+ #
+ # PLEASE DO NOT EDIT THIS FILE MANUALLY.
+ #
+ HEADER_COMMENT
+ file.write(feature_categories.to_yaml)
+end