|
56 | 56 | path: services/backend |
57 | 57 | - name: Extract release notes |
58 | 58 | 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 |
62 | 89 | - name: Create pull request |
63 | 90 | uses: peter-evans/create-pull-request@v7 |
64 | 91 | id: cpr |
|
0 commit comments