forked from nickcharlton/administrate-field-nested_has_many
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script to build the changelog (nickcharlton#74)
Inspired by the one on Administrate itself: https://github.com/thoughtbot/administrate/blob/main/bin/build-changelog
- Loading branch information
1 parent
d7cb720
commit 6625781
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if ! command -v gh > /dev/null; then | ||
echo "Please install the GitHub CLI: https://cli.github.com/" | ||
exit 1 | ||
fi | ||
|
||
last_release=$(git describe --tag --abbrev=0) | ||
|
||
revision_range="${last_release}..origin/main" | ||
commit_format="--pretty=tformat:%h %s" | ||
commits_since=$(git log --author="^(?!dependabot).*$" --perl-regexp "${revision_range}" "${commit_format}") | ||
|
||
echo "$commits_since" | while read -r line; do | ||
sha=$(echo "${line}" | awk '{print $1}') | ||
commit_message=$(echo "${line}" | awk '{print substr($0, index($0, " ")+1)}') | ||
|
||
pr_number=$(gh pr list --search "$sha" --state merged --json number --jq '.[].number') | ||
trimmed_commit=$(echo "${commit_message}"| sed "s/ (\#$pr_number)//g") | ||
|
||
echo "* ${trimmed_commit} (#${pr_number})" | ||
done |