diff --git a/scripts/generate-changelog.sh b/scripts/generate-changelog.sh index d630712214d7..37388e4c0f48 100755 --- a/scripts/generate-changelog.sh +++ b/scripts/generate-changelog.sh @@ -7,22 +7,25 @@ copy_tools=("xclip" "wl-copy" "pbcopy") # Find the first available tool for tool in "${copy_tools[@]}"; do - if command -v "$tool" > /dev/null 2>&1; then - selected_tool="$tool" - break - fi + if command -v "$tool" >/dev/null 2>&1; then + selected_tool="$tool" + break + fi done # Check if a tool was found if [[ -z "$selected_tool" ]]; then - echo "No suitable copy tool found. Please install xclip, wl-copy, or pbcopy." - exit 1 + echo "No suitable copy tool found. Please install xclip, wl-copy, or pbcopy." + exit 1 fi git fetch # Get two most recent release branches -mapfile -t branches < <(git for-each-ref --sort=-committerdate refs/heads/release/ --format='%(refname:short)' | head -n2) +branches=() +while IFS= read -r line; do + branches+=("$line") +done < <(git for-each-ref --sort=-committerdate refs/heads/release/ --format='%(refname:short)' | head -n2) npx generate-changelog -t "${branches[1]}".."${branches[0]}" -a -f - | $selected_tool echo "Changelog copied to clipboard using $selected_tool"