Skip to content

Commit a905a21

Browse files
author
AR Abdul Azeez
committed
picking up from last release tag
1 parent fb67b9e commit a905a21

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

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

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,25 @@ jobs:
5656
git commit -am "chore: bump SDK_VERSION to $VERSION"
5757
git push origin "$BRANCH"
5858
59+
- name: Fetch Last GitHub Release Tag
60+
id: fetch_last_release
61+
run: |
62+
echo "Fetching latest GitHub release tag..."
63+
LAST_TAG=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')
64+
65+
if [[ -z "$LAST_TAG" ]]; then
66+
echo "❌ No previous release tag found. Cannot generate release notes."
67+
exit 0
68+
fi
69+
70+
echo "✅ Found last release tag: $LAST_TAG"
71+
echo "range=$LAST_TAG..HEAD" >> $GITHUB_OUTPUT
72+
5973
- name: Generate Release Notes from PR titles
6074
id: generate_notes
75+
if: steps.fetch_last_release.outputs.range != ''
6176
run: |
77+
RANGE: ${{ steps.fetch_last_release.outputs.range }}
6278
echo "## 🔖 Auto-Generated Release Notes" > pr_body.md
6379
echo "" >> pr_body.md
6480
@@ -73,17 +89,9 @@ jobs:
7389
echo "**Channels:** $CHANNEL" >> pr_body.md
7490
echo "" >> pr_body.md
7591
76-
LAST_REL_MERGE_SHA=$(git log origin/main --merges --pretty=format:"%H %s" | grep -m1 "Merge pull request" | grep "from rel/" | cut -d' ' -f1)
77-
78-
if [[ -z "$LAST_REL_MERGE_SHA" ]]; then
79-
echo "⚠️ Could not find previous rel/* merge. Using fallback HEAD~50"
80-
RANGE="HEAD~50..HEAD"
81-
else
82-
echo "✅ Last rel/* merge SHA: $LAST_REL_MERGE_SHA"
83-
RANGE="$LAST_REL_MERGE_SHA..HEAD"
84-
fi
92+
echo "Using commit range: $RANGE"
8593
86-
PR_TITLES=$(git log $RANGE --pretty=format:"%s" | grep -E '^Merge pull request' | awk -F'"' '{print $2}')
94+
PR_TITLES=$(git log "$RANGE" --pretty=format:"%s" | grep -E '^Merge pull request' | awk -F'"' '{print $2}')
8795
8896
if [[ -z "$PR_TITLES" ]]; then
8997
echo "❌ No merged PRs found since last release. Exiting safely."

0 commit comments

Comments
 (0)