Skip to content

Commit 45e9168

Browse files
committed
refactor(build): simplify release summary generation
1 parent 28fd0bd commit 45e9168

File tree

1 file changed

+30
-37
lines changed

1 file changed

+30
-37
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
runs-on: ubuntu-latest
1818
permissions:
1919
contents: write
20-
models: read
2120
steps:
2221
- name: Checkout
2322
uses: actions/checkout@v4
@@ -91,59 +90,53 @@ jobs:
9190
echo "📝 Recent commits:"
9291
echo "$COMMITS"
9392
94-
- name: Generate release summary with GitHub Copilot
93+
- name: Generate release summary
9594
id: summary
96-
uses: github/copilot-models-action@v1
97-
with:
98-
model: gpt-4o
99-
prompt: |
100-
You are a release notes writer for a Ghost blog theme called "Attegi".
101-
Based on the git commits below, generate a concise release summary.
102-
103-
Commits:
104-
${{ steps.diff.outputs.commits }}
105-
106-
Requirements:
107-
- Group into: ✨ New Features, 🐛 Bug Fixes, 🎨 Improvements, 📝 Documentation
108-
- Only include categories with changes
109-
- Keep each item to 1 line
110-
- Maximum 10 items
111-
- No code fences
112-
- If minimal changes, write "Minor updates and improvements"
113-
114-
- name: Fallback summary
115-
id: fallback
116-
if: failure() || steps.summary.outputs.response == ''
11795
run: |
118-
# Generate simple summary from commits
119-
COMMITS=$(cat /tmp/commits.txt | head -10)
96+
# Read commits
97+
COMMITS=$(cat /tmp/commits.txt)
12098
121-
# Categorize commits
122-
FEATURES=$(echo "$COMMITS" | grep -iE "^- (feat|add|new)" | head -5 || true)
123-
FIXES=$(echo "$COMMITS" | grep -iE "^- (fix|bug|patch)" | head -3 || true)
124-
IMPROVEMENTS=$(echo "$COMMITS" | grep -iE "^- (improve|update|refactor|enhance|style)" | head -3 || true)
125-
DOCS=$(echo "$COMMITS" | grep -iE "^- (doc|readme)" | head -2 || true)
99+
# Categorize commits by conventional commit prefixes
100+
FEATURES=$(echo "$COMMITS" | grep -iE "^- feat" | sed 's/^- feat[^:]*: /- /' | head -5 || true)
101+
FIXES=$(echo "$COMMITS" | grep -iE "^- fix" | sed 's/^- fix[^:]*: /- /' | head -3 || true)
102+
IMPROVEMENTS=$(echo "$COMMITS" | grep -iE "^- (improve|update|refactor|enhance|style|perf)" | sed 's/^- [^:]*: /- /' | head -3 || true)
103+
DOCS=$(echo "$COMMITS" | grep -iE "^- doc" | sed 's/^- doc[^:]*: /- /' | head -2 || true)
126104
105+
# Build summary
127106
SUMMARY=""
128107
if [ -n "$FEATURES" ]; then
129-
SUMMARY="${SUMMARY}#### ✨ New Features\n${FEATURES}\n\n"
108+
SUMMARY="${SUMMARY}#### ✨ New Features
109+
${FEATURES}
110+
111+
"
130112
fi
131113
if [ -n "$FIXES" ]; then
132-
SUMMARY="${SUMMARY}#### 🐛 Bug Fixes\n${FIXES}\n\n"
114+
SUMMARY="${SUMMARY}#### 🐛 Bug Fixes
115+
${FIXES}
116+
117+
"
133118
fi
134119
if [ -n "$IMPROVEMENTS" ]; then
135-
SUMMARY="${SUMMARY}#### 🎨 Improvements\n${IMPROVEMENTS}\n\n"
120+
SUMMARY="${SUMMARY}#### 🎨 Improvements
121+
${IMPROVEMENTS}
122+
123+
"
136124
fi
137125
if [ -n "$DOCS" ]; then
138-
SUMMARY="${SUMMARY}#### 📝 Documentation\n${DOCS}\n\n"
126+
SUMMARY="${SUMMARY}#### 📝 Documentation
127+
${DOCS}
128+
129+
"
139130
fi
140131
132+
# Default if empty
141133
if [ -z "$SUMMARY" ]; then
142-
SUMMARY="Minor updates and improvements"
134+
SUMMARY="Minor updates and improvements. See commits below for details."
143135
fi
144136
137+
# Output
145138
echo "response<<EOF" >> $GITHUB_OUTPUT
146-
echo -e "$SUMMARY" >> $GITHUB_OUTPUT
139+
echo "$SUMMARY" >> $GITHUB_OUTPUT
147140
echo "EOF" >> $GITHUB_OUTPUT
148141
149142
- name: Build and package
@@ -194,7 +187,7 @@ jobs:
194187
195188
### 📝 What's Changed
196189
197-
${{ steps.summary.outputs.response || steps.fallback.outputs.response || 'See commits below for details.' }}
190+
${{ steps.summary.outputs.response }}
198191
199192
### 📥 Installation
200193

0 commit comments

Comments
 (0)