packer-cn/scripts/prepare_changelog.sh

79 lines
2.3 KiB
Bash
Raw Permalink Normal View History

#!/bin/zsh
LAST_RELEASE=$1
2017-10-10 00:31:19 -04:00
DO_PR_CHECK=1
set -o pipefail
2020-02-12 12:25:54 -05:00
is_doc_or_tech_debt_pr(){
2017-10-10 00:31:19 -04:00
if ! (($+commands[jq])); then
DO_PR_CHECK=0
echo "jq not found"
return 1
fi
2020-06-12 11:25:52 -04:00
out=$(cat pull.json | python -m json.tool \
| jq '[.labels[].name == "docs" or .labels[].name == "tech-debt" or .labels[].name == "website"] | any')
2017-10-10 00:31:19 -04:00
grep -q true <<< $out
return $?
}
if [ -z $LAST_RELEASE ]; then
echo "you need to give the previous release version. prepare_changelog.sh v<version>"
exit 1
fi
2017-10-10 00:31:19 -04:00
get_prs(){
# git log v0.10.2...c3861d167533fb797b0fae0c380806625712e5f7 |
scripts/prepare_changelog: Update unescape parenthesis for improved matching Before change ``` 413e19b84 Merge pull request #8942 from desolatorxxl/google-fix-ssh-keys-metadata b81800db2 Merge pull request #8935 from zaventh/feature/start-on-boot 94863168b Merge pull request #8922 from hashicorp/f-vsphere_iso-export-ovf-options 56aebbeda Merge pull request #8920 from rhencke/patch-1 d068430ab make sure locals are evaluated only once variables are + test this (#8918) 3dae5df6e Merge pull request #8905 from hashicorp/fix_8493 811a7304a Merge pull request #8907 from hashicorp/fix_8428 fa49d2145 Merge pull request #8906 from hashicorp/fix_8904 23f56036a Merge pull request #8889 from hashicorp/hcl2_singular_blocks dc9259f73 Merge pull request #8892 from zaventh/feature/vga-adapter fc35f0200 Merge pull request #8890 from hashicorp/fix_8880 7972ab723 Merge pull request #8735 from hashicorp/fix_plugin_loading 890d7b2ec Merge pull request #8875 from hashicorp/fix_8812 e94ff7019 Merge pull request #8883 from hashicorp/fix_8835 9075b807d Merge pull request #8891 from rhencke/patch-1 6477d8a0c Merge pull request #8882 from hashicorp/fix-var-file-hcl 6008f911f Merge pull request #8847 from takaishi/support-keyboard-interactive 56045619d Merge pull request #8877 from paulcichonski/remote-esxi-bastion 698f74478 Merge pull request #8887 from hashicorp/untangle_ssh_docs_from_aws aeedc9af7 Merge pull request #8879 from mbrancato/specify_keyvault_sku 5365fda5f Merge pull request #8884 from hashicorp/fix_codecov_config 4bd7b1409 Merge pull request #8732 from jhawk28/reorder_cdrom_drive 072a71b41 Merge pull request #8863 from hashicorp/update_go-cty_regex 8a1caaa80 Merge pull request #8837 from hashicorp/fix_8730 7873cabf6 Merge pull request #8858 from hashicorp/fix_8791 7e382d0df Merge pull request #8828 from mvitaly/fix_8816 8832b3e2c Merge pull request #8787 from jhawk28/vsphere_iso_multiple_disks 528174027 Merge pull request #8831 from rjhornsby/master e35a87241 Merge pull request #8830 from hashicorp/d-var-file-hcl2-not-yet ``` After change ``` ⇶ git log v1.5.4...v1.5.5 --first-parent --oneline --grep="Merge pull request #[0-9]\+" --grep="(#[0-9]\+)$" 413e19b84 Merge pull request #8942 from desolatorxxl/google-fix-ssh-keys-metadata c387dc2c5 builder/vsphere-clone: Find the vm within the folder (#8938) b17b211aa Add cleanup_remote_cache config option to vmware-iso (#8917) e6368b924 Fix azure winrm_password attribution and allow to set winrm_username (#8928) fcf10e9b7 Replace Amazon with Outscale for OSC BSU doc (#8944) 9240fb7f0 Fix typo in title (#8943) 2c6f0968b Allow accepting image for the members in OpenStack builder (#8931) b81800db2 Merge pull request #8935 from zaventh/feature/start-on-boot daffd9c31 CONTRIBUTING: Update documentation for linting on Travis (#8933) 3a9d356c9 golangci-lint: Update --new-from-rev option to check only newly added commits (#8923) 97d797d2f Fix small typos in osc-bsuvolume.html.md (#8926) 94863168b Merge pull request #8922 from hashicorp/f-vsphere_iso-export-ovf-options 56aebbeda Merge pull request #8920 from rhencke/patch-1 99b0b9831 Add ovf export capability to vsphere builders (#8764) d068430ab make sure locals are evaluated only once variables are + test this (#8918) ad8dafa3b HCL: add tests and fixes around var-file and var args (#8914) 7979ab054 Add after_n_builds to codecov.yml (#8913) 3dae5df6e Merge pull request #8905 from hashicorp/fix_8493 811a7304a Merge pull request #8907 from hashicorp/fix_8428 fa49d2145 Merge pull request #8906 from hashicorp/fix_8904 b94937c05 Update provisioner_test.go (#8900) 2319521aa Add iso config test for checksum from file specific case (#8897) 23f56036a Merge pull request #8889 from hashicorp/hcl2_singular_blocks dc9259f73 Merge pull request #8892 from zaventh/feature/vga-adapter 690bf714c Add Codecov badge and remove report style (#8896) fc35f0200 Merge pull request #8890 from hashicorp/fix_8880 7972ab723 Merge pull request #8735 from hashicorp/fix_plugin_loading 890d7b2ec Merge pull request #8875 from hashicorp/fix_8812 e94ff7019 Merge pull request #8883 from hashicorp/fix_8835 ```
2020-03-27 07:19:49 -04:00
git log HEAD...${LAST_RELEASE} --first-parent --oneline --grep="Merge pull request #[0-9]\+" --grep="(#[0-9]\+)$" |
grep -o "#\([0-9]\+\)" | awk -F\# '{print $2}' | while read line
2017-10-10 00:31:19 -04:00
do
grep -q "GH-${line}" CHANGELOG.md
if [ $? -ne 0 ]; then
echo $line
fi
done | while read PR_NUM
do
2020-06-12 11:25:52 -04:00
if [[ -z "${GITHUB_TOKEN}" ]] || [[ -z "${GITHUB_USERNAME}" ]] ; then
out=$(curl -fsS "https://api.github.com/repos/hashicorp/packer/issues/${PR_NUM}" -o pull.json)
else
# authenticated call
out=$(curl -u ${GITHUB_USERNAME}:${GITHUB_TOKEN} -fsS "https://api.github.com/repos/hashicorp/packer/issues/${PR_NUM}" -o pull.json)
fi
exy="$?"
if [ $exy -ne 0 ]; then
echo "bad response from github: manually check PR ${PR_NUM}"
continue
fi
if (($DO_PR_CHECK)) && is_doc_or_tech_debt_pr; then
echo "Skipping PR ${PR_NUM}: labeled as tech debt, docs or website. (waiting a second so we don't get rate-limited...)"
2017-10-10 00:31:19 -04:00
continue
fi
2020-06-12 11:25:52 -04:00
echo "$(cat pull.json | python -m json.tool | jq '.title') - https://github.com/hashicorp/packer/pull/${PR_NUM}"
2017-10-10 00:31:19 -04:00
done
}
2020-02-12 12:25:54 -05:00
#is_doc_or_tech_debt_pr 52061111
# is_doc_or_tech_debt_pr 5206 # non-doc pr
#is_doc_or_tech_debt_pr 5434 # doc pr
2017-10-10 00:31:19 -04:00
#echo $?
#exit
# prpid=$!
# trap 'kill -9 ${prpid}; exit' INT TERM
get_prs | while read line; do
echo $line
2017-10-10 00:31:19 -04:00
if [[ "$line" =~ "bad" ]]; then
exit 1
elif [[ "$line" =~ "Skipping" ]]; then
sleep 1 # GH will rate limit us if we have several in a row
continue
2017-10-10 00:31:19 -04:00
fi
rm -f pull.json
vared -ch ok
done
#TODO: just generate it automatically using PR titles and tags