Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update install_docs_from_release.sh #218

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion scripts/install_docs_from_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,29 @@ RELEASE="$2"

# If no release is specified, download the latest release
if [ "$RELEASE" == "" ]; then
RELEASE=$(curl -s "https://api.github.com/repos/MicrosoftDocs/executable-docs/releases/latest" | jq -r ".tag_name")
PAGE=1
RELEASE=""

while :; do
RESPONSE=$(curl -s "https://api.github.com/repos/MicrosoftDocs/executable-docs/releases?page=$PAGE")
if [ "$(echo $RESPONSE | jq '. | length')" -eq 0 ]; then
break
fi

RELEASE=$(echo $RESPONSE | jq -r '[.[] | select(.tag_name | startswith("v")) | .tag_name] | .[0]')

if [ "$RELEASE" != "null" ] && [ -n "$RELEASE" ]; then
break
fi

PAGE=$((PAGE + 1))
done
fi

# Set a default scenarios file
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/$RELEASE/scenarios.zip"

echo $SCENARIOS
# If the LANG parameter was set, download appropriate script
if [ "$LANG" != "" ]; then
# Map the language parameter to the corresponding scenarios file
Expand Down
Loading