File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 6161 env :
6262 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6363
64+ - name : Check if release notes are empty and add commit log fallback
65+ run : |
66+ RELEASE_BODY=$(gh release view "${{ inputs.version }}" --json body -q .body)
67+
68+ # Check if release body is empty or just says "No changes"
69+ if [[ -z "$RELEASE_BODY" ]] || [[ "$RELEASE_BODY" =~ "No changes" ]]; then
70+ echo "Release notes are empty or contain 'No changes'. Generating commit log..."
71+
72+ # Get the previous tag
73+ PREV_TAG=$(git describe --tags --abbrev=0 "${{ inputs.version }}^" 2>/dev/null || echo "")
74+
75+ if [[ -z "$PREV_TAG" ]]; then
76+ # If no previous tag, get all commits
77+ COMMIT_LOG=$(git log --pretty=format:"* %s (%h)" "${{ inputs.version }}")
78+ else
79+ # Get commits between previous tag and current tag
80+ COMMIT_LOG=$(git log --pretty=format:"* %s (%h)" "$PREV_TAG..${{ inputs.version }}")
81+ fi
82+
83+ # Update release notes with commit log
84+ echo "## Changes" > /tmp/release_notes.md
85+ echo "" >> /tmp/release_notes.md
86+ echo "$COMMIT_LOG" >> /tmp/release_notes.md
87+
88+ gh release edit "${{ inputs.version }}" --notes-file /tmp/release_notes.md
89+ echo "Release notes updated with commit log."
90+ else
91+ echo "Release notes already contain content from Release Drafter."
92+ fi
93+ env :
94+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
95+
6496 build-and-publish :
6597 name : Build and Publish
6698 needs : create-release
You can’t perform that action at this time.
0 commit comments