| 123456789101112131415161718192021222324252627282930313233343536373839404142 | #!/bin/bashset -eset -x## Usage :## changelog PREVIOUS_TAG..HEAD# configure refs so we get pull-requests metadatagit config --add remote.origin.fetch +refs/pull/*/head:refs/remotes/origin/pull/*git fetch originRANGE=${1:-"$(git describe --tags  --abbrev=0)..HEAD"}echo "Generate changelog for range ${RANGE}"echopullrequests() {    for commit in $(git log ${RANGE} --format='format:%H'); do        # Get the oldest remotes/origin/pull/* branch to include this commit, i.e. the one to introduce it        git branch -a --sort=committerdate  --contains $commit --list 'origin/pull/*' | head -1 | cut -d'/' -f4    done}changes=$(pullrequests | uniq)echo "pull requests merged within range:"echo $changesecho '#Features' > FEATURES.mdecho '#Bugs' > BUGS.mdfor pr in $changes; do    curl -fs -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/docker/compose/pulls/${pr} -o PR.json    cat PR.json | jq -r ' select( .labels[].name | contains("kind/feature") ) | "- "+.title' >> FEATURES.md    cat PR.json | jq -r ' select( .labels[].name | contains("kind/bug") ) | "- "+.title' >> BUGS.mddoneecho ${TAG_NAME} > CHANGELOG.mdecho >> CHANGELOG.mdcat FEATURES.md >> CHANGELOG.mdecho >> CHANGELOG.mdcat BUGS.md >> CHANGELOG.md
 |