|
68 | 68 | - name: Create Release |
69 | 69 | if: steps.version_check.outputs.versionChanged == 'true' |
70 | 70 | run: | |
71 | | - # Get the previous version tag or initial commit |
72 | | - PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo $(git rev-list --max-parents=0 HEAD)) |
73 | 71 | CURR_TAG="v${{ steps.version_check.outputs.rawVersion }}" |
74 | | -
|
75 | | - # Initialize release notes file |
76 | | - echo "## What's Changed" > release_notes.md |
77 | | - echo "" >> release_notes.md |
78 | | -
|
79 | | - # Get all commits between previous tag and HEAD |
80 | | - for COMMIT_HASH in $(git log --no-merges --pretty=format:"%H" $PREV_TAG..HEAD); do |
81 | | - # Get commit message |
82 | | - COMMIT_MSG=$(git log --format=%B -n 1 $COMMIT_HASH) |
83 | | -
|
84 | | - # Extract PR number if present |
85 | | - PR_NUM=$(echo "$COMMIT_MSG" | grep -o "#[0-9]\+" | head -1 | tr -d "#") |
86 | | -
|
87 | | - if [ -n "$PR_NUM" ]; then |
88 | | - # PR number found, try to get commits from this PR |
89 | | - echo "### $COMMIT_MSG" >> release_notes.md |
90 | | -
|
91 | | - # Check if PR exists before trying to view it |
92 | | - if gh pr view $PR_NUM --json number &>/dev/null; then |
93 | | - PR_COMMITS=$(gh pr view $PR_NUM --json commits --jq '.commits[].messageHeadline') |
94 | | -
|
95 | | - if [ -n "$PR_COMMITS" ]; then |
96 | | - # Add indented PR commits to notes, but filter out the main PR commit |
97 | | - echo "$PR_COMMITS" | grep -v "Merge" | grep -v "$COMMIT_MSG" | sed 's/^/ - /' >> release_notes.md |
98 | | - fi |
99 | | - else |
100 | | - echo " - PR #$PR_NUM not found or not accessible" >> release_notes.md |
101 | | - fi |
102 | | - else |
103 | | - # Regular commit, not from a squashed PR |
104 | | - echo "* $COMMIT_MSG" >> release_notes.md |
105 | | - fi |
106 | | - done |
107 | | -
|
108 | | - gh release create "$CURR_TAG" --title "$CURR_TAG" --notes-file release_notes.md |
| 72 | + gh release create "$CURR_TAG" --title "$CURR_TAG" --notes "Release $CURR_TAG" |
109 | 73 | env: |
110 | 74 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
111 | 75 |
|
|
0 commit comments