Skip to content

Commit c4ef2b9

Browse files
committed
feat(ops): fix changelog error
1 parent db03712 commit c4ef2b9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/release.yml

+12
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,18 @@ jobs:
159159
160160
echo "Creating temporary branch based on origin/main..."
161161
# Create a new branch based on the fetched origin/main
162+
echo "Stashing generated CHANGELOG.md..."
163+
# Stash the generated changelog (include untracked files like CHANGELOG.md if new)
164+
git stash push -u -- CHANGELOG.md
165+
162166
git checkout -b changelog-update origin/main
163167
164168
echo "Adding and committing CHANGELOG.md..."
169+
echo "Applying stashed CHANGELOG.md..."
170+
# Apply the stashed changes (the generated CHANGELOG.md)
171+
# Use || true in case stash is empty (e.g., changelog didn't change)
172+
git stash pop || true
173+
165174
git add ./CHANGELOG.md
166175
# Check if there are changes to commit to avoid empty commit error if file exists and is unchanged
167176
if ! git diff --staged --quiet; then
@@ -170,6 +179,9 @@ jobs:
170179
echo "No changes to CHANGELOG.md to commit."
171180
fi
172181
182+
183+
echo "Cleaning up temporary local branch..."
184+
git branch -D changelog-update
173185
echo "Pushing changelog commit to remote main branch..."
174186
# Push the new local branch specifically to the remote *branch* main
175187
git push origin changelog-update:refs/heads/main

0 commit comments

Comments
 (0)