Skip to content

Commit ac8db56

Browse files
committed
[API] Generator: Updates source code docs url generation
1 parent d79dac3 commit ac8db56

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

elasticsearch-api/utils/thor/generator/files_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ def self.output_dir
4444

4545
def self.documentation_url(documentation_url)
4646
branch = `git rev-parse --abbrev-ref HEAD`
47-
return documentation_url if branch == "main\n"
47+
return documentation_url.gsub(/\/(master|main)\//, "/current/") if branch == "main\n"
4848

4949
regex = /([0-9]{1,2}\.[0-9x]{1,2})/
5050
version = Elasticsearch::API::VERSION.match(regex)[0]
5151
# TODO - How do we fix this so it doesn't depend on which branch we're running from
5252
if ENV['IGNORE_VERSION']
53-
documentation_url
53+
documentation_url.gsub(/\/(master|main)\//, "/current/")
5454
else
5555
documentation_url.gsub(/\/(current|master|main)\//, "/#{version}/")
5656
end

0 commit comments

Comments
 (0)