File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ tag=$1
6+ if [[ -z ${tag:- } ]] || (( $# != 1 )) ; then
7+ echo ' tag must be provided as the only cli arg' >&2
8+ exit 1
9+ fi
10+ if ! git tag | grep -q " ^$tag $" ; then
11+ echo " $tag is not a git tag" >&2
12+ exit 1
13+ fi
14+
15+ ghnotes=$(
16+ gh api \
17+ --method POST \
18+ --header " Accept: application/vnd.github+json" \
19+ --header " X-GitHub-Api-Version: 2022-11-28" \
20+ --field " tag_name=$tag " \
21+ --jq .body \
22+ repos/{owner}/{repo}/releases/generate-notes
23+ )
24+
25+ range=$( awk -F/ ' END {print $NF}' <<< " $ghnotes" )
26+ fullchangelog=$( tail -n1 <<< " $ghnotes" )
27+ ghnotes=$( head -n -2 <<< " $ghnotes)" )
28+ diffstat=$( git diff --stat " $range " )
29+ shortlog=$( git shortlog -w0 --no-merges " $range " )
30+
31+ gh release create " $tag " --notes "
32+ $ghnotes
33+
34+ $diffstat
35+
36+ $shortlog
37+
38+ $fullchangelog
39+ "
You can’t perform that action at this time.
0 commit comments