Skip to content

Commit

Permalink
chore: macos support for generate-changelog.sh (#14583)
Browse files Browse the repository at this point in the history
  • Loading branch information
busla authored Jun 11, 2024
1 parent 6b940d9 commit b589b1a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions scripts/generate-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit b589b1a

Please sign in to comment.