Skip to content

Commit 8e3e13f

Browse files
committed
fix: handle non-existing version gracefully by falling back to main
1 parent f283af0 commit 8e3e13f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/download-oas.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fi
2020

2121
if [[ -z ${OAS_API_VERSIONS} ]]; then
2222
echo "No API version passed, using ${ROOTDIR}/api-versions.json"
23-
OAS_API_VERSIONS="${ROOTDIR}/api-versions.json"
23+
OAS_API_VERSIONS="${ROOT_DIR}/api-versions.json"
2424
fi
2525

2626
# Create temp directory to clone OAS repo
@@ -55,7 +55,7 @@ EOF
5555
echo "Using ${apiVersion} for ${service}"
5656
fi
5757
cd ${work_dir}/${OAS_REPO_NAME} > /dev/null
58-
git checkout -q $apiVersion
58+
git checkout -q $apiVersion || (echo "version ${apiVersion} does not exist, using main instead" && git checkout -q main)
5959
cd - > /dev/null
6060

6161
# Prioritize GA over Beta over Alpha versions

0 commit comments

Comments
 (0)