Files

57 lines
1.5 KiB
Bash
Raw Permalink Normal View History

2017-01-20 12:10:13 -08:00
#!/bin/zsh
# Copyright (c) HashiCorp, Inc.
2023-08-10 15:53:29 -07:00
# SPDX-License-Identifier: BUSL-1.1
2017-01-20 12:10:13 -08:00
LAST_RELEASE=$1
2017-10-09 21:31:19 -07:00
set -o pipefail
2017-01-20 12:10:13 -08:00
if [ -z $LAST_RELEASE ]; then
echo "you need to give the previous release version. prepare_changelog.sh v<version>"
exit 1
fi
if [ -z "$(which jq)" ]; then
echo "jq command not found"
return 1
fi
if [ -z "$(which jq)" ]; then
echo "gh command not found"
return 1
fi
2017-10-09 21:31:19 -07:00
get_prs(){
release_time="$(gh release view --json "createdAt" --jq '.createdAt' ${LAST_RELEASE})"
gh pr list -s merged -S "merged:>=$release_time -label:documentation -label:automated -label:tech-debt -label:website -label:legal -label:docs -author:hc-github-team-packer" --json "number" --jq '.[]|.number' \
| while read line
2017-10-09 21:31:19 -07:00
do
if grep -q "GH-${line}" CHANGELOG.md; then
continue
2017-10-09 21:31:19 -07:00
fi
echo $line
2017-10-09 21:31:19 -07:00
done | while read PR_NUM
do
out=$(gh pr view ${PR_NUM} --json "title,labels,url" > pull.json)
if [ "$?" -ne 0 ]; then
2020-06-12 17:25:52 +02:00
echo "bad response from github: manually check PR ${PR_NUM}"
continue
fi
echo "$(jq -r '.title' < pull.json) - [GH-${PR_NUM}](https://github.com/hashicorp/packer/pull/${PR_NUM})"
rm -f pull.json
2017-10-09 21:31:19 -07:00
done
}
2017-01-20 12:10:13 -08:00
2017-10-09 21:31:19 -07:00
get_prs | while read line; do
2017-01-20 12:10:13 -08:00
echo $line
2017-10-09 21:31:19 -07:00
if [[ "$line" =~ "bad" ]]; then
exit 1
fi
echo "Press enter to continue with next entry."
vared -ch ok
2017-01-20 12:10:13 -08:00
done
#TODO: just generate it automatically using PR titles and tags