Skip to content

Commit 5523fd6

Browse files
committed
new contributors section
1 parent fb90ce9 commit 5523fd6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/rust-release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,34 @@ jobs:
378378
CHANGELOG=$(./rust/scripts/generate-workspace-changelog.sh "${PREV_TAG}..${COMMIT_RANGE_END}")
379379
fi
380380
381+
# Generate new contributors section using GitHub's auto-generated notes
382+
NEW_CONTRIBUTORS=""
383+
if [ -n "$PREV_TAG" ]; then
384+
# Use GitHub API to generate release notes and extract new contributors
385+
AUTO_NOTES=$(gh api --method POST "/repos/${{ github.repository }}/releases/generate-notes" \
386+
-f tag_name="$TAG_NAME" \
387+
-f target_commitish="$COMMIT_RANGE_END" \
388+
-f previous_tag_name="$PREV_TAG" \
389+
--jq '.body' 2>/dev/null || echo "")
390+
391+
# Extract the "New Contributors" section if it exists
392+
if [ -n "$AUTO_NOTES" ]; then
393+
NEW_CONTRIBUTORS=$(echo "$AUTO_NOTES" | sed -n '/^## New Contributors$/,/^## /p' | sed '$d')
394+
# If we got the section, add proper spacing
395+
if [ -n "$NEW_CONTRIBUTORS" ]; then
396+
NEW_CONTRIBUTORS=$'\n\n'"${NEW_CONTRIBUTORS}"
397+
fi
398+
fi
399+
fi
400+
381401
# Add warning for pre-releases
382402
if [ "$IS_PRERELEASE" = "true" ]; then
383403
CHANGELOG="⚠️ **This is a pre-release version.**"$'\n\n'"${CHANGELOG}"
384404
fi
385405
406+
# Append new contributors section
407+
CHANGELOG="${CHANGELOG}${NEW_CONTRIBUTORS}"
408+
386409
# Create tag and GitHub release
387410
git tag -a "$TAG_NAME" -m "$RELEASE_TYPE $TAG_NAME"
388411
git push origin "$TAG_NAME"

0 commit comments

Comments
 (0)