github.com/cli/cli@v1.14.1-0.20210902173923-1af6a669e342/script/changelog (about) 1 #!/bin/bash 2 set -e 3 4 current_tag="${GITHUB_REF#refs/tags/}" 5 start_ref="HEAD" 6 7 # Find the previous release on the same branch, skipping prereleases if the 8 # current tag is a full release 9 previous_tag="" 10 while [[ -z $previous_tag || ( $previous_tag == *-* && $current_tag != *-* ) ]]; do 11 previous_tag="$(git describe --tags "$start_ref"^ --abbrev=0)" 12 start_ref="$previous_tag" 13 done 14 15 git log "$previous_tag".. --reverse --first-parent --oneline | \ 16 while read -r sha title; do 17 if [[ $title == "Merge pull request #"* ]]; then 18 pr_num="$(grep -o '#[[:digit:]]\+' <<<"$title")" 19 pr_desc="$(git show -s --format=%b "$sha" | sed -n '1,/^$/p' | tr $'\n' ' ')" 20 printf "* %s %s\n\n" "$pr_desc" "$pr_num" 21 else 22 printf "* %s\n\n" "$title" 23 fi 24 done