Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Add helper scripts for cleaning up GREN release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
stealthybox committed Nov 9, 2020
1 parent 8463489 commit 0819186
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
41 changes: 41 additions & 0 deletions hack/find-extra-prs-not-in-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

PREVIOUS_TAG=${1}
RELEASE_NOTES=${2}

usage() {
echo "This script is useful for finding extra PR's in a GREN generated release_notes/changelog file."
echo "It checks the GREN changelog for PR numbers that aren't present the git merge log on your local machine."
echo
echo "usage:"
echo " $0 <previous_tag> <release_notes_file>"
echo
echo "example:"
echo " check for extra PR's in the v0.8.0 release notes"
echo
echo " $0 v0.7.1 ./docs/releases/v0.8.0.md"
}

if ! [ "${1}" ] || ! [ "${2}" ]; then
usage
exit 1
fi

recent_prs_from_git() {
git log "${PREVIOUS_TAG}.." --merges --oneline | grep -o '#[1-9][0-9]*'
}

release_note_prs() {
grep -o -E "pull/[0-9][0-9]*" "${RELEASE_NOTES}" | sed 's,pull/,#,'
}

format_grep_filter() {
printf "|%s" "$@" | sed 's/^|//'
}

missing_prs() {
release_note_prs | grep -v -E "$(format_grep_filter $(recent_prs_from_git))"
}

hub pr list -s closed \
| grep -E "$(format_grep_filter $(missing_prs))"
41 changes: 41 additions & 0 deletions hack/find-undocumented-release-prs-from-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

PREVIOUS_TAG=${1}
RELEASE_NOTES=${2}

usage() {
echo "This script is useful for finding uncredited/undocumented PR's in a GREN generated release_notes/changelog file."
echo "It checks the git merge log on your local machine for PR numbers that aren't present in the GREN changelog."
echo
echo "usage:"
echo " $0 <previous_tag> <release_notes_file>"
echo
echo "example:"
echo " check for PR's missing from the v0.8.0 release notes"
echo
echo " $0 v0.7.1 ./docs/releases/v0.8.0.md"
}

if ! [ "${1}" ] || ! [ "${2}" ]; then
usage
exit 1
fi

recent_prs_from_git() {
git log "${PREVIOUS_TAG}.." --merges --oneline | grep -o '#[1-9][0-9]*'
}

missing_prs() {
for pr in $(recent_prs_from_git); do
if ! grep "$pr" "${RELEASE_NOTES}" >/dev/null; then
echo "$pr"
fi
done
}

format_grep_filter() {
printf "|%s" "$@" | sed 's/^|//'
}

hub pr list -s closed \
| grep -E "$(format_grep_filter $(missing_prs))"

0 comments on commit 0819186

Please sign in to comment.