Skip to content

Commit 6f4c97a

Browse files
committed
Fix shell variable globbing issue using quotes
1 parent 59a8c86 commit 6f4c97a

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

.github/scripts/release-docs.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ 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+
# shellcheck disable=SC2086
79+
release_notes_content=$("${ROOTDIR}"/.github/scripts/pull-release-notes.py "${ic_version}" "${helm_chart_version}" "${k8s_versions}" "${release_date}")
7980
if [ $? -ne 0 ]; then
8081
echo "ERROR: failed to fetch release notes from GitHub draft release for version ${ic_version}"
8182
exit 2
@@ -111,7 +112,7 @@ if [ $? -ne 0 ]; then
111112
exit 2
112113
fi
113114

114-
cd ${DOCS_FOLDER}
115+
cd ${DOCS_FOLDER} || exit 2
115116
if [ "${DEBUG}" != "false" ]; then
116117
echo "DEBUG: Cloned doc repo to ${DOCS_FOLDER} and changed directory"
117118
fi
@@ -123,15 +124,15 @@ if [ "${DEBUG}" != "false" ]; then
123124
fi
124125

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

128129
if [ -n "${remote_branch}" ]; then
129-
git checkout ${branch}
130+
git checkout "${branch}"
130131
if [ "${DEBUG}" != "false" ]; then
131132
echo "DEBUG: Checked out existing branch ${branch}"
132133
fi
133134
else
134-
git checkout -b ${branch}
135+
git checkout -b "${branch}"
135136
if [ "${DEBUG}" != "false" ]; then
136137
echo "DEBUG: Created new branch ${branch}"
137138
fi
@@ -227,7 +228,7 @@ EOF
227228
if [ "${DEBUG}" != "false" ]; then
228229
echo "DEBUG: Release content starts at line: ${release_start:-'not found'}"
229230
fi
230-
[ -n "${release_start}" ] && tail -n +${release_start} "${TMPDIR}/temp_index.md" >> "${archive_file}"
231+
[ -n "${release_start}" ] && tail -n +"${release_start}" "${TMPDIR}/temp_index.md" >> "${archive_file}"
231232

232233
# Create new index for new year
233234
echo "INFO: Creating new _index.md for year ${release_year}"
@@ -288,7 +289,7 @@ else
288289
echo "" >> "${TMPDIR}/final_index.md"
289290
echo "${release_notes_content}" >> "${TMPDIR}/final_index.md"
290291
echo "" >> "${TMPDIR}/final_index.md"
291-
tail -n +${insert_line} "${TMPDIR}/temp_index.md" >> "${TMPDIR}/final_index.md"
292+
tail -n +"${insert_line}" "${TMPDIR}/temp_index.md" >> "${TMPDIR}/final_index.md"
292293

293294
mv "${TMPDIR}/final_index.md" "${index_file_path}"
294295
fi
@@ -321,13 +322,13 @@ if [ "${DRY_RUN}" == "false" ]; then
321322
fi
322323

323324
echo "INFO: Pushing changes to the documentation repository"
324-
git push origin ${branch}
325+
git push origin "${branch}"
325326
if [ $? -ne 0 ]; then
326327
echo "ERROR: failed pushing changes to the docs repo"
327328
exit 2
328329
fi
329330
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
331+
gh pr create --title "Update release notes for ${ic_version}" --body "Update release notes for ${ic_version}" --head "${branch}" --draft
331332
else
332333
echo "INFO: DRY_RUN: Showing what would be committed:"
333334
git status --porcelain

0 commit comments

Comments
 (0)