From 5ef45c65b2e7a070e4ad416827a694a53bd95b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=20Lin=29?= Date: Tue, 1 Oct 2024 13:45:43 +0800 Subject: [PATCH] fix(generate-release-description): Fix inconsistent style of the release description content when the project has a single release tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `git_log_opts` array variable isn't initialized before being referenced in the single commit if case: https://gitlab.com/the-common/project-template/-/blob/daebf87b/continuous-integration/generate-release-description.sh#L52 This patch moves the assignment of the `git_log_opts` array variable at https://gitlab.com/the-common/project-template/-/blob/daebf87b/continuous-integration/generate-release-description.sh#L107 before the `if` built-in command call. Signed-off-by: ๆž—ๅšไป(Buo-ren Lin) --- continuous-integration/generate-release-description.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/continuous-integration/generate-release-description.sh b/continuous-integration/generate-release-description.sh index 031e059..b6504d4 100755 --- a/continuous-integration/generate-release-description.sh +++ b/continuous-integration/generate-release-description.sh @@ -43,6 +43,9 @@ if test -v CI_COMMIT_TAG; then release_tag="${CI_COMMIT_TAG}" fi +git_log_opts=( + --format='format:* %s (%h) - %an' +) if test "${git_tag_count}" -eq 1; then printf \ 'Info: Only one release tag was detected, generating the release description text from the very beginning to the "%s" release tag...\n' \ @@ -104,9 +107,6 @@ else "${previous_git_tag}" \ "${release_tag}" \ 1>&2 - git_log_opts=( - --format='format:* %s (%h) - %an' - ) if ! detailed_changes_markup+="$( git log \ "${git_log_opts[@]}" \