Skip to content

Commit cdad72c

Browse files
committed
fix regex matching for breaking changes
1 parent 735e6af commit cdad72c

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

scripts/draft-changelog.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash -e
2+
3+
# Find the latest release tag that's in the current branch's history
4+
latest_tag=""
5+
for tag in $(git tag -l "v*.*.*" --sort=-version:refname); do
6+
if git merge-base --is-ancestor "$tag" HEAD; then
7+
latest_tag="$tag"
8+
break
9+
fi
10+
done
11+
12+
if [[ -z $latest_tag ]]; then
13+
echo "No release tags found in current branch history"
14+
exit 1
15+
fi
16+
17+
echo "# Changes since $latest_tag:"
18+
echo
19+
20+
# Generate changelog entries from commits since the tag
21+
git log --reverse \
22+
--perl-regexp \
23+
--author='^(?!dependabot\[bot\] )(?!github-actions\[bot\] )' \
24+
--pretty=format:"- %s" \
25+
"$latest_tag..HEAD" \
26+
| grep -E '\(#[0-9]+\)$' \
27+
| grep -v '^- Post release ' \
28+
| sed -E 's,\(#([0-9]+)\)$, ([#\1](https://github.com/aws-observability/aws-otel-java-instrumentation/pull/\1)),'

scripts/find_breaking_changes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def get_releases_with_breaking_changes(repo, current_version, new_version):
4646

4747
# Check if release notes have breaking changes as headers
4848
body = release.get("body", "")
49-
breaking_header_pattern = r'^#+.*breaking changes'
50-
if re.search(breaking_header_pattern, body, re.IGNORECASE | re.MULTILINE):
49+
breaking_header_pattern = r'^\s*#+.*Breaking changes'
50+
if re.search(breaking_header_pattern, body, re.MULTILINE):
5151
breaking_releases.append(
5252
{
5353
"version": release_version,

0 commit comments

Comments
 (0)