Skip to content

Commit 2ea556e

Browse files
authored
Fix shell variable globbing issue using quotes (#8605)
1 parent e073c88 commit 2ea556e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

.github/scripts/release-docs.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if [ "${DEBUG}" != "false" ]; then
7575
fi
7676

7777
echo "INFO: Generating release notes from github draft release"
78-
release_notes_content=$(${ROOTDIR}/.github/scripts/pull-release-notes.py ${ic_version} ${helm_chart_version} ${k8s_versions} "${release_date}")
78+
release_notes_content=$("${ROOTDIR}"/.github/scripts/pull-release-notes.py "${ic_version}" "${helm_chart_version}" "${k8s_versions}" "${release_date}")
7979
if [ $? -ne 0 ]; then
8080
echo "ERROR: failed to fetch release notes from GitHub draft release for version ${ic_version}"
8181
exit 2
@@ -111,7 +111,7 @@ if [ $? -ne 0 ]; then
111111
exit 2
112112
fi
113113

114-
cd ${DOCS_FOLDER}
114+
cd ${DOCS_FOLDER} || exit 2
115115
if [ "${DEBUG}" != "false" ]; then
116116
echo "DEBUG: Cloned doc repo to ${DOCS_FOLDER} and changed directory"
117117
fi
@@ -123,15 +123,15 @@ if [ "${DEBUG}" != "false" ]; then
123123
fi
124124

125125
echo "INFO: Checking out branch ${branch} in the documentation repository"
126-
remote_branch=$(git ls-remote --heads origin ${branch} 2> /dev/null)
126+
remote_branch=$(git ls-remote --heads origin "${branch}" 2> /dev/null)
127127

128128
if [ -n "${remote_branch}" ]; then
129-
git checkout ${branch}
129+
git checkout "${branch}"
130130
if [ "${DEBUG}" != "false" ]; then
131131
echo "DEBUG: Checked out existing branch ${branch}"
132132
fi
133133
else
134-
git checkout -b ${branch}
134+
git checkout -b "${branch}"
135135
if [ "${DEBUG}" != "false" ]; then
136136
echo "DEBUG: Created new branch ${branch}"
137137
fi
@@ -227,7 +227,7 @@ EOF
227227
if [ "${DEBUG}" != "false" ]; then
228228
echo "DEBUG: Release content starts at line: ${release_start:-'not found'}"
229229
fi
230-
[ -n "${release_start}" ] && tail -n +${release_start} "${TMPDIR}/temp_index.md" >> "${archive_file}"
230+
[ -n "${release_start}" ] && tail -n +"${release_start}" "${TMPDIR}/temp_index.md" >> "${archive_file}"
231231

232232
# Create new index for new year
233233
echo "INFO: Creating new _index.md for year ${release_year}"
@@ -288,7 +288,7 @@ else
288288
echo "" >> "${TMPDIR}/final_index.md"
289289
echo "${release_notes_content}" >> "${TMPDIR}/final_index.md"
290290
echo "" >> "${TMPDIR}/final_index.md"
291-
tail -n +${insert_line} "${TMPDIR}/temp_index.md" >> "${TMPDIR}/final_index.md"
291+
tail -n +"${insert_line}" "${TMPDIR}/temp_index.md" >> "${TMPDIR}/final_index.md"
292292

293293
mv "${TMPDIR}/final_index.md" "${index_file_path}"
294294
fi
@@ -321,13 +321,13 @@ if [ "${DRY_RUN}" == "false" ]; then
321321
fi
322322

323323
echo "INFO: Pushing changes to the documentation repository"
324-
git push origin ${branch}
324+
git push origin "${branch}"
325325
if [ $? -ne 0 ]; then
326326
echo "ERROR: failed pushing changes to the docs repo"
327327
exit 2
328328
fi
329329
echo "INFO: Creating pull request for the documentation repository"
330-
gh pr create --title "Update release notes for ${ic_version}" --body "Update release notes for ${ic_version}" --head ${branch} --draft
330+
gh pr create --title "Update release notes for ${ic_version}" --body "Update release notes for ${ic_version}" --head "${branch}" --draft
331331
else
332332
echo "INFO: DRY_RUN: Showing what would be committed:"
333333
git status --porcelain

0 commit comments

Comments
 (0)