Repository navigation
Expand file tree
/
Copy pathrelease_notes.sh
More file actions
executable file
·48 lines (42 loc) · 1.57 KB
/
Copy pathrelease_notes.sh
File metadata and controls
executable file
·48 lines (42 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# This script generates release notes by extracting changelog entries
# from merged PRs since the latest release tag. These should be placed
# in docs/manual/releases.rst and tidied up before publishing a new release.
# Get the latest release tag and date
LATEST_TAG=$(gh release view --json tagName -q .tagName)
RELEASE_DATE=$(git log "$LATEST_TAG" -1 --format=%cI)
echo ""
echo "=========================================================="
echo "Checking PRs merged after $RELEASE_DATE (tag: $LATEST_TAG)"
echo ""
# Get all merged PRs since the release date
gh pr list --state merged --limit 100 --json number,mergedAt,body,title | \
jq -r --arg date "$RELEASE_DATE" '
.[] |
select(.mergedAt > $date) |
"\(.number)"
' | \
while read -r pr_number; do
# Get PR details
pr_data=$(gh pr view "$pr_number" --json body,title)
title=$(echo "$pr_data" | jq -r .title)
body=$(echo "$pr_data" | jq -r .body)
# Extract the changelog section and remove HTML comments (including multiline)
changelog_entries=$(echo "$body" | \
sed -n '/## Changelog entry/,/^## /p' | \
sed '/<!--/,/-->/d' | \
sed '/^## Changelog entry/d' | \
sed '/^## /d' | \
sed '/^$/d' | \
grep -v '^[[:space:]]*$')
# Skip if it contains the template text (unchanged template)
if echo "$changelog_entries" | grep -q "Added: Some new feature"; then
continue
fi
# Only output if we found actual changelog entries
if [ -n "$changelog_entries" ]; then
echo "=== PR #$pr_number: $title ==="
echo "$changelog_entries" | awk '{print " " $0}'
echo ""
fi
done