File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
1
3
BLUE=' \033[0;34m'
2
4
NC=' \033[0m' # No Color
3
5
6
+ SPEC_BRANCH=" master"
7
+ if [[ " $GIT_LOCAL_BRANCH " =~ ^(master| development)$ ]]; then
8
+ SPEC_BRANCH=" ${GIT_LOCAL_BRANCH} "
9
+ fi
10
+
4
11
SPEC_FILE=" "
5
12
if [ -n ${1} ]; then
6
13
SPEC_FILE=../${1}
24
31
echo
25
32
printf " ${BLUE} Fetching API specs${NC} \n"
26
33
cd -
27
- curl https://raw.githubusercontent.com/linode/linode-api-docs/master /openapi.yaml > static/api/docs/v4/openapi.yaml;
34
+ curl " https://raw.githubusercontent.com/linode/linode-api-docs/${SPEC_BRANCH} /openapi.yaml" > static/api/docs/v4/openapi.yaml;
28
35
fi
29
36
30
37
echo
@@ -37,4 +44,4 @@ printf "${BLUE}Converting YAML to JSON${NC}\n"
37
44
node_modules/yamljs/bin/yaml2json static/api/docs/v4/openapi.yaml > static/api/docs/v4/spec.json
38
45
# some data manipulation to fix the result of the conversion above
39
46
sed -i.bak ' s@\\\\[[:space:]]@\\\\\\n @g' static/api/docs/v4/spec.json
40
- rm static/api/docs/v4/spec.json.bak
47
+ rm static/api/docs/v4/spec.json.bak
You can’t perform that action at this time.
0 commit comments