Skip to content

Commit a0209a0

Browse files
style: Replace test brackets with double brackets in shell script (#288)
1 parent 79792cc commit a0209a0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

scripts/readthedocs_build.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ theme_dir="."
3838

3939
# if not the theme project then we need to clone the theme with submodules
4040
sub_project="false"
41-
if [ "${READTHEDOCS_PROJECT}" != "lizardbyte-gh-pages-main" ]; then
41+
if [[ "${READTHEDOCS_PROJECT}" != "lizardbyte-gh-pages-main" ]]; then
4242
sub_project="true"
4343
echo "Building a subproject: ${READTHEDOCS_PROJECT}"
4444
echo "github workflow: ${github_workflow}"
@@ -53,13 +53,13 @@ if [ "${READTHEDOCS_PROJECT}" != "lizardbyte-gh-pages-main" ]; then
5353
sleep_interval=10
5454

5555
# fail if the workflow is not set
56-
if [ -z "${github_workflow}" ]; then
56+
if [[ -z "${github_workflow}" ]]; then
5757
echo "github_workflow is not set"
5858
exit 1
5959
fi
6060

6161
# fail if the site artifact is not set
62-
if [ -z "${site_artifact}" ]; then
62+
if [[ -z "${site_artifact}" ]]; then
6363
echo "site_artifact is not set"
6464
exit 1
6565
fi
@@ -83,7 +83,7 @@ if [ "${READTHEDOCS_PROJECT}" != "lizardbyte-gh-pages-main" ]; then
8383
count=1
8484
while true; do
8585
current_time=$(date +%s)
86-
if [ "${current_time}" -gt ${max_time} ]; then
86+
if [[ "${current_time}" -gt ${max_time} ]]; then
8787
echo "Timeout waiting for check runs"
8888
exit 1
8989
fi
@@ -95,7 +95,7 @@ if [ "${READTHEDOCS_PROJECT}" != "lizardbyte-gh-pages-main" ]; then
9595

9696
echo "Check runs count: ${check_run_count}"
9797

98-
if [ "${check_run_count}" -gt 0 ]; then
98+
if [[ "${check_run_count}" -gt 0 ]]; then
9999
check_run=$(echo "${check_runs}" | jq -r '.[0]')
100100
check_job_id=$(echo "${check_run}" | jq -r '.id')
101101
check_run_html_url=$(echo "${check_run}" | jq -r '.html_url')
@@ -121,7 +121,7 @@ if [ "${READTHEDOCS_PROJECT}" != "lizardbyte-gh-pages-main" ]; then
121121
count=1
122122
while true; do
123123
current_time=$(date +%s)
124-
if [ "${current_time}" -gt ${max_time} ]; then
124+
if [[ "${current_time}" -gt ${max_time} ]]; then
125125
echo "Timeout waiting for check runs"
126126
exit 1
127127
fi
@@ -133,7 +133,7 @@ if [ "${READTHEDOCS_PROJECT}" != "lizardbyte-gh-pages-main" ]; then
133133
check_run_conclusion=$(echo "${check_run_response}" | jq -r '.conclusion')
134134

135135
echo "Check run status: ${check_run_status}"
136-
if [ "${check_run_status}" == "completed" ]; then
136+
if [[ "${check_run_status}" == "completed" ]]; then
137137
break
138138
fi
139139

@@ -143,7 +143,7 @@ if [ "${READTHEDOCS_PROJECT}" != "lizardbyte-gh-pages-main" ]; then
143143
done
144144

145145
# if not successful then exit
146-
if [ "${check_run_conclusion}" != "success" ]; then
146+
if [[ "${check_run_conclusion}" != "success" ]]; then
147147
echo "Check run did not complete successfully"
148148
exit 1
149149
fi
@@ -157,7 +157,7 @@ if [ "${READTHEDOCS_PROJECT}" != "lizardbyte-gh-pages-main" ]; then
157157
rm "${project_dir}/artifact.zip"
158158

159159
# if there is a name provided for extract_artifact, then we will extract the nested archive
160-
if [ -n "${extract_archive}" ]; then
160+
if [[ -n "${extract_archive}" ]]; then
161161
pushd "${project_dir}"
162162
case "${extract_archive}" in
163163
*.tar.gz|*.tgz)
@@ -205,7 +205,7 @@ targets=(
205205

206206
for base_dir in "${base_dirs[@]}"; do
207207
for target in "${targets[@]}"; do
208-
if [ -e "${base_dir}/${target}" ]; then
208+
if [[ -e "${base_dir}/${target}" ]]; then
209209
cp -rf "${base_dir}/${target}" "${TMPDIR}/"
210210
fi
211211
done
@@ -225,7 +225,7 @@ echo "_config_theme.yml:"
225225
cat _config_theme.yml
226226

227227
config_files=_config_rtd.yml,_config_theme.yml
228-
if [ -n "${config_file}" ] && [ -e "${config_file}" ]; then
228+
if [[ -n "${config_file}" ]] && [[ -e "${config_file}" ]]; then
229229
config_files="${config_files},${config_file}"
230230
echo "config file: ${config_file}"
231231
cat "${config_file}"
@@ -237,7 +237,7 @@ bundle exec jekyll build \
237237
--destination "${READTHEDOCS_OUTPUT}html"
238238

239239
# mimic gh-pages
240-
if [ "${sub_project}" == "true" ]; then
240+
if [[ "${sub_project}" == "true" ]]; then
241241
mkdir -p "${READTHEDOCS_OUTPUT}html/${github_repo}/assets"
242242
cp -RTf "${READTHEDOCS_OUTPUT}html/assets" "${READTHEDOCS_OUTPUT}html/${github_repo}/assets"
243243
fi

0 commit comments

Comments
 (0)