minikube/hack/release_notes.sh

66 lines
2.8 KiB
Bash
Raw Normal View History

2018-10-04 21:28:39 +00:00
#!/bin/bash
2018-10-04 21:40:48 +00:00
# Copyright 2018 The Kubernetes Authors All rights reserved.
2018-10-04 21:28:39 +00:00
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2018-10-04 21:40:48 +00:00
set -eu -o pipefail
2018-10-04 21:28:39 +00:00
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Parse the token from `gh auth`
2021-07-15 20:19:07 +00:00
GH_TOKEN=$(mktemp)
gh auth status -t 2>&1 | sed -n -r 's/^.*Token: ([a-zA-Z0-9_]*)/\1/p' > "$GH_TOKEN"
# Ensure the token is deleted when the script exits, so the token is not leaked.
function cleanup_token() {
2021-07-15 20:19:07 +00:00
rm -f "$GH_TOKEN"
}
trap cleanup_token EXIT
2022-10-14 23:46:46 +00:00
if ! [[ -x "${DIR}/release-notes" ]] || ! [[ -x "${DIR}/pullsheet" ]]; then
echo >&2 'Installing release-notes'
2022-10-14 23:46:46 +00:00
GOBIN="$DIR" go install github.com/corneliusweig/release-notes@latest
GOBIN="$DIR" go install github.com/google/pullsheet@latest
fi
git pull https://github.com/kubernetes/minikube.git master --tags
2019-12-02 22:46:31 +00:00
recent=$(git describe --abbrev=0)
recent_date=$(git log -1 --format=%as $recent)
2019-12-02 22:46:31 +00:00
2022-10-14 23:46:46 +00:00
"${DIR}/release-notes" kubernetes minikube --since $recent
2018-10-04 21:28:39 +00:00
echo ""
2022-01-29 00:41:41 +00:00
echo "For a more detailed changelog, including changes occurring in pre-release versions, see [CHANGELOG.md](https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md)."
echo ""
echo "Thank you to our contributors for this release!"
echo ""
2019-12-02 22:46:31 +00:00
git log "$recent".. --format="%aN" --reverse | sort | uniq | awk '{printf "- %s\n", $0 }'
echo ""
echo "Thank you to our PR reviewers for this release!"
echo ""
AWK_FORMAT_ITEM='{printf "- %s (%d comments)\n", $2, $1}'
AWK_REVIEW_COMMENTS='NR>1{arr[$4] += $6 + $7}END{for (a in arr) printf "%d %s\n", arr[a], a}'
2022-10-14 23:46:46 +00:00
"${DIR}/pullsheet" reviews --since "$recent_date" --repos kubernetes/minikube --token-path "$GH_TOKEN" --logtostderr=false --stderrthreshold=2 | awk -F ',' "$AWK_REVIEW_COMMENTS" | sort -k1nr -k2d | awk -F ' ' "$AWK_FORMAT_ITEM"
echo ""
echo "Thank you to our triage members for this release!"
echo ""
AWK_ISSUE_COMMENTS='NR>1{arr[$4] += $7}END{for (a in arr) printf "%d %s\n", arr[a], a}'
2022-10-14 23:46:46 +00:00
"${DIR}/pullsheet" issue-comments --since "$recent_date" --repos kubernetes/minikube --token-path "$GH_TOKEN" --logtostderr=false --stderrthreshold=2 | awk -F ',' "$AWK_ISSUE_COMMENTS" | sort -k1nr -k2d | awk -F ' ' "$AWK_FORMAT_ITEM" | head -n 5
if [[ "$recent" != *"beta"* ]]; then
echo ""
echo "Check out our [contributions leaderboard](https://minikube.sigs.k8s.io/docs/contrib/leaderboard/$recent/) for this release!"
fi