Skip to content

Commit fdb777d

Browse files
committed
new contributors section
1 parent 3b46cf3 commit fdb777d

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

0 commit comments

Comments
 (0)