2017-01-20 15:10:13 -05:00
|
|
|
#!/bin/zsh
|
2023-03-02 15:37:05 -05:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
2023-08-10 18:53:29 -04:00
|
|
|
# SPDX-License-Identifier: BUSL-1.1
|
2023-03-02 15:37:05 -05:00
|
|
|
|
2017-01-20 15:10:13 -05:00
|
|
|
|
|
|
|
|
LAST_RELEASE=$1
|
2017-10-10 00:31:19 -04:00
|
|
|
|
|
|
|
|
set -o pipefail
|
|
|
|
|
|
2017-01-20 15:10:13 -05:00
|
|
|
if [ -z $LAST_RELEASE ]; then
|
|
|
|
|
echo "you need to give the previous release version. prepare_changelog.sh v<version>"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2023-11-08 18:53:35 -05:00
|
|
|
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-10 00:31:19 -04:00
|
|
|
get_prs(){
|
2023-11-08 18:53:35 -05:00
|
|
|
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-10 00:31:19 -04:00
|
|
|
do
|
2023-11-08 18:53:35 -05:00
|
|
|
if grep -q "GH-${line}" CHANGELOG.md; then
|
2023-11-10 09:34:33 -05:00
|
|
|
continue
|
2017-10-10 00:31:19 -04:00
|
|
|
fi
|
2023-11-10 09:34:33 -05:00
|
|
|
echo $line
|
2017-10-10 00:31:19 -04:00
|
|
|
done | while read PR_NUM
|
|
|
|
|
do
|
2023-11-08 18:53:35 -05:00
|
|
|
out=$(gh pr view ${PR_NUM} --json "title,labels,url" > pull.json)
|
|
|
|
|
if [ "$?" -ne 0 ]; then
|
2020-06-12 11:25:52 -04:00
|
|
|
echo "bad response from github: manually check PR ${PR_NUM}"
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
|
2023-11-08 18:53:35 -05:00
|
|
|
echo "$(jq -r '.title' < pull.json) - [GH-${PR_NUM}](https://github.com/hashicorp/packer/pull/${PR_NUM})"
|
|
|
|
|
rm -f pull.json
|
2017-10-10 00:31:19 -04:00
|
|
|
done
|
|
|
|
|
}
|
2017-01-20 15:10:13 -05:00
|
|
|
|
2017-10-10 00:31:19 -04:00
|
|
|
get_prs | while read line; do
|
2017-01-20 15:10:13 -05:00
|
|
|
echo $line
|
2017-10-10 00:31:19 -04:00
|
|
|
if [[ "$line" =~ "bad" ]]; then
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2024-05-31 05:49:23 -04:00
|
|
|
echo "Press enter to continue with next entry."
|
|
|
|
|
vared -ch ok
|
2017-01-20 15:10:13 -05:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
#TODO: just generate it automatically using PR titles and tags
|