11#! /bin/bash -e
22
3+ # this has mostly been replaced by .github/scripts/draft-release-notes/draft-release-notes.py
4+ # keeping this around as a backup since that script relies on Copilot CLI
5+
36version=$( " $( dirname " $0 " ) /get-version.sh" )
47
58if [[ $version =~ ([0-9]+)\. ([0-9]+)\. 0 ]]; then
@@ -27,9 +30,10 @@ echo "# Changelog"
2730echo
2831echo " ## Unreleased"
2932echo
30-
31- " $( dirname " $0 " ) /extract-labeled-prs.sh" " $range "
32-
33+ echo " ### ⚠️ Breaking changes to non-stable APIs"
34+ echo
35+ echo " ### 🚫 Deprecations"
36+ echo
3337echo " ### 🌟 New javaagent instrumentation"
3438echo
3539echo " ### 🌟 New library instrumentation"
@@ -38,100 +42,10 @@ echo "### 📈 Enhancements"
3842echo
3943echo " ### 🛠️ Bug fixes"
4044echo
41- echo " ### 🧰 Tooling"
42- echo
43-
44- # Group commits by file type and @Deprecated detection
45- declare -A src_main_commits
46- declare -A no_src_main_commits
47- declare -A deprecated_added_commits
48- declare -A deprecated_removed_commits
49-
50- format_commit_msg () {
51- git log --format=%s -n 1 " $1 " | sed -E ' s, *\(#([0-9]+)\)$,\n ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'
52- }
53-
54- while IFS= read -r commit_hash; do
55- files=$( git diff-tree --no-commit-id --name-only -r " $commit_hash " )
56-
57- has_src_main=false
58-
59- while IFS= read -r file; do
60- if [[ $file =~ /src/main/ ]] && [[ ! $file =~ ^smoke-tests/ ]] && [[ ! $file =~ ^smoke-tests-otel-starter/ ]] && [[ ! $file =~ /testing/ ]] && [[ ! $file =~ -t esting/ ]] && [[ ! $file =~ ^instrumentation-docs/ ]]; then
61- has_src_main=true
62- break
63- fi
64- done <<< " $files"
65-
66- commit_msg=$( git log --format=%s -n 1 " $commit_hash " | sed -E ' s, *\(#([0-9]+)\)$,\n ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),' )
67-
68- # Check diff for @Deprecated additions/removals in src/main Java files
69- # Count added vs removed to distinguish real changes from moves/refactors
70- diff_output=$( git diff-tree -p " $commit_hash " -- ' */src/main/**/*.java' 2> /dev/null || true)
71-
72- added_count=$( echo " $diff_output " | grep -cP ' ^\+(?!\+).*@Deprecated' || true)
73- removed_count=$( echo " $diff_output " | grep -cP ' ^-(?!-).*@Deprecated' || true)
7445
75- # Net new @Deprecated annotations = new deprecation
76- if [[ $added_count -gt $removed_count ]]; then
77- deprecated_added_commits[" $commit_hash " ]=1
78- fi
79- # Net removed @Deprecated annotations = removed deprecated API (breaking)
80- if [[ $removed_count -gt $added_count ]]; then
81- deprecated_removed_commits[" $commit_hash " ]=1
82- fi
83-
84- # Categorize commit
85- if [[ $has_src_main == true ]]; then
86- src_main_commits[" $commit_hash " ]=" $commit_msg "
87- else
88- no_src_main_commits[" $commit_hash " ]=" $commit_msg "
89- fi
90- done < <( git log --reverse --perl-regexp --author=' ^(?!renovate\[bot\] )' --pretty=format:" %H" " $range " )
91-
92- # Output @Deprecated-based breaking changes (removed @Deprecated = removed deprecated API)
93- if [[ ${# deprecated_removed_commits[@]} -gt 0 ]]; then
94- echo " #### Possible breaking changes (diff removes @Deprecated)"
95- echo
96- for commit_hash in $( git log --reverse --perl-regexp --author=' ^(?!renovate\[bot\] )' --pretty=format:" %H" " $range " ) ; do
97- if [[ -n ${deprecated_removed_commits[$commit_hash]} ]]; then
98- echo " - $( format_commit_msg " $commit_hash " ) "
99- fi
100- done
101- echo
102- fi
103-
104- # Output @Deprecated-based deprecations (added @Deprecated = new deprecation)
105- if [[ ${# deprecated_added_commits[@]} -gt 0 ]]; then
106- echo " #### Possible deprecations (diff adds @Deprecated)"
107- echo
108- for commit_hash in $( git log --reverse --perl-regexp --author=' ^(?!renovate\[bot\] )' --pretty=format:" %H" " $range " ) ; do
109- if [[ -n ${deprecated_added_commits[$commit_hash]} ]]; then
110- echo " - $( format_commit_msg " $commit_hash " ) "
111- fi
112- done
113- echo
114- fi
115-
116- # Output grouped commits
117- if [[ ${# src_main_commits[@]} -gt 0 ]]; then
118- echo " #### Changes with src/main updates"
119- echo
120- for commit_hash in $( git log --reverse --perl-regexp --author=' ^(?!renovate\[bot\] )' --pretty=format:" %H" " $range " ) ; do
121- if [[ -n ${src_main_commits[$commit_hash]} ]] && [[ -z ${deprecated_added_commits[$commit_hash]} ]] && [[ -z ${deprecated_removed_commits[$commit_hash]} ]]; then
122- echo " - $( format_commit_msg " $commit_hash " ) "
123- fi
124- done
125- echo
126- fi
127-
128- if [[ ${# no_src_main_commits[@]} -gt 0 ]]; then
129- echo " #### Changes without src/main updates"
130- echo
131- for commit_hash in $( git log --reverse --perl-regexp --author=' ^(?!renovate\[bot\] )' --pretty=format:" %H" " $range " ) ; do
132- if [[ -n ${no_src_main_commits[$commit_hash]} ]] && [[ -z ${deprecated_added_commits[$commit_hash]} ]] && [[ -z ${deprecated_removed_commits[$commit_hash]} ]]; then
133- echo " - $( format_commit_msg " $commit_hash " ) "
134- fi
135- done
136- echo
137- fi
46+ git log --reverse \
47+ --perl-regexp \
48+ --author=' ^(?!renovate\[bot\] )' \
49+ --pretty=format:" - %s" \
50+ " $range " \
51+ | sed -E ' s,\(#([0-9]+)\)$,\n ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'
0 commit comments