Skip to content

Commit 838a2b7

Browse files
author
Lasim
committed
fix: enhance release notes extraction in backend release workflow
1 parent de0d463 commit 838a2b7

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

.github/workflows/backend-release-pr.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,36 @@ jobs:
5656
path: services/backend
5757
- name: Extract release notes
5858
id: extract-release-notes
59-
uses: ffurrer2/extract-release-notes@v2
60-
with:
61-
changelog_file: services/backend/CHANGELOG.md
59+
run: |
60+
# Get the current version
61+
VERSION=$(cat services/backend/package.json | grep '"version"' | cut -d'"' -f4)
62+
echo "Extracting release notes for version $VERSION"
63+
64+
# Extract the changelog section for this version
65+
if [ -f services/backend/CHANGELOG.md ]; then
66+
# Look for the version header and extract content until the next version or end of file
67+
RELEASE_NOTES=$(awk -v version="$VERSION" '
68+
BEGIN { found=0; content="" }
69+
/^##? [0-9]+\.[0-9]+\.[0-9]+/ {
70+
if (found) exit
71+
if ($0 ~ version) { found=1; next }
72+
}
73+
found && /^##? [0-9]+\.[0-9]+\.[0-9]+/ { exit }
74+
found { content = content $0 "\n" }
75+
END { print content }
76+
' services/backend/CHANGELOG.md)
77+
78+
# Remove leading/trailing whitespace and save to output
79+
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
80+
echo "$RELEASE_NOTES" | sed '/^$/d' >> $GITHUB_OUTPUT
81+
echo "EOF" >> $GITHUB_OUTPUT
82+
83+
echo "Release notes extracted:"
84+
echo "$RELEASE_NOTES"
85+
else
86+
echo "No CHANGELOG.md found"
87+
echo "release_notes=" >> $GITHUB_OUTPUT
88+
fi
6289
- name: Create pull request
6390
uses: peter-evans/create-pull-request@v7
6491
id: cpr

0 commit comments

Comments
 (0)