Skip to content

Commit d4fbc4f

Browse files
committed
Add contributors to release notes
1 parent 537cf46 commit d4fbc4f

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

.github/workflows/release-publish.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,51 @@ jobs:
6969
echo "CHANGELOG_EOF"
7070
} >> $GITHUB_OUTPUT
7171
72+
- name: Get contributors from changelog PRs
73+
id: contributors
74+
env:
75+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
CHANGELOG: ${{ steps.changelog.outputs.body }}
77+
run: |
78+
# Extract PR numbers from changelog links like [#123](...).
79+
PR_NUMBERS=$(echo "$CHANGELOG" | grep -oE '\[#[0-9]+\]' | tr -d '[]#' | sort -u)
80+
81+
CONTRIBUTORS=""
82+
if [ -n "$PR_NUMBERS" ]; then
83+
# Build a single GraphQL query to fetch all PR authors.
84+
QUERY='{ repository(owner: "${{ github.repository_owner }}", name: "${{ github.event.repository.name }}") {'
85+
while IFS= read -r PR; do
86+
[ -n "$PR" ] && QUERY="$QUERY pr$PR: pullRequest(number: $PR) { author { login } }"
87+
done <<< "$PR_NUMBERS"
88+
QUERY="$QUERY } }"
89+
90+
CONTRIBUTORS=$(gh api graphql -f query="$QUERY" \
91+
--jq '[.data.repository[].author.login] | unique | map("@" + .) | join(", ")' 2>/dev/null || true)
92+
fi
93+
echo "list=$CONTRIBUTORS" >> $GITHUB_OUTPUT
94+
7295
- name: Create GitHub release
7396
env:
7497
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7598
TAG: ${{ steps.version.outputs.tag }}
7699
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
77100
BODY: ${{ steps.changelog.outputs.body }}
101+
CONTRIBUTORS: ${{ steps.contributors.outputs.list }}
78102
run: |
79103
PRERELEASE_FLAG=""
80104
if [[ "${{ steps.version.outputs.prerelease }}" == "true" ]]; then
81105
PRERELEASE_FLAG="--prerelease"
82106
fi
83107
108+
NOTES="$BODY"
109+
if [ -n "$CONTRIBUTORS" ]; then
110+
NOTES="$(printf '%s\n\n**Contributors:** %s' "$BODY" "$CONTRIBUTORS")"
111+
fi
112+
84113
gh release create "$TAG" \
85114
--target "$MERGE_SHA" \
86115
--title "$TAG" \
87-
--notes "$BODY" \
116+
--notes "$NOTES" \
88117
$PRERELEASE_FLAG \
89118
"build/plugin-sqlite-database-integration.zip"
90119

0 commit comments

Comments
 (0)