@@ -150,6 +150,7 @@ def get_changeset_metadata(changeset_path: Path) -> dict:
150
150
)
151
151
if gh_result .stdout .strip ():
152
152
metadata ["pr_author" ] = gh_result .stdout .strip ()
153
+ metadata ["pr_author_is_username" ] = True
153
154
154
155
# Also try to get co-authors from PR commits
155
156
try :
@@ -176,6 +177,7 @@ def get_changeset_metadata(changeset_path: Path) -> dict:
176
177
commit_authors .discard ('' ) # Remove empty strings
177
178
if commit_authors :
178
179
metadata ["co_authors" ] = list (commit_authors )
180
+ metadata ["co_authors_are_usernames" ] = True
179
181
except Exception :
180
182
pass
181
183
@@ -188,6 +190,7 @@ def get_changeset_metadata(changeset_path: Path) -> dict:
188
190
)
189
191
if author_result .stdout .strip ():
190
192
metadata ["pr_author" ] = author_result .stdout .strip ()
193
+ metadata ["pr_author_is_username" ] = False
191
194
else :
192
195
# No PR number found, use commit author
193
196
author_result = subprocess .run (
@@ -197,6 +200,7 @@ def get_changeset_metadata(changeset_path: Path) -> dict:
197
200
)
198
201
if author_result .stdout .strip ():
199
202
metadata ["pr_author" ] = author_result .stdout .strip ()
203
+ metadata ["pr_author_is_username" ] = False
200
204
201
205
# Extract co-authors from commit message if we don't already have
202
206
# them from GitHub API
@@ -213,6 +217,7 @@ def get_changeset_metadata(changeset_path: Path) -> dict:
213
217
and co_author_name != metadata .get ("pr_author" )
214
218
):
215
219
co_authors .append (co_author_name )
220
+ metadata ["co_authors_are_usernames" ] = False
216
221
217
222
if co_authors :
218
223
metadata ["co_authors" ] = co_authors
@@ -226,6 +231,9 @@ def get_changeset_metadata(changeset_path: Path) -> dict:
226
231
metadata ["pr_number" ] = os .environ .get ("PR_NUMBER" , "" )
227
232
if not metadata .get ("pr_author" ):
228
233
metadata ["pr_author" ] = os .environ .get ("PR_AUTHOR" , "" )
234
+ # Assume env var contains username if it exists
235
+ if metadata ["pr_author" ]:
236
+ metadata ["pr_author_is_username" ] = True
229
237
if not metadata .get ("commit_hash" ):
230
238
metadata ["commit_hash" ] = os .environ .get (
231
239
"COMMIT_SHA" , git_info .get ("commit" , "" )
@@ -239,7 +247,9 @@ def format_changelog_entry(entry: dict, config: dict, pr_metadata: dict) -> str:
239
247
description = entry ["description" ]
240
248
pr_number = pr_metadata .get ("pr_number" )
241
249
pr_author = pr_metadata .get ("pr_author" )
250
+ pr_author_is_username = pr_metadata .get ("pr_author_is_username" , False )
242
251
co_authors = pr_metadata .get ("co_authors" , [])
252
+ co_authors_are_usernames = pr_metadata .get ("co_authors_are_usernames" , False )
243
253
commit_hash = pr_metadata .get ("commit_hash" , "" )[:7 ]
244
254
repo_url = pr_metadata .get ("repo_url" , "" )
245
255
@@ -257,18 +267,24 @@ def format_changelog_entry(entry: dict, config: dict, pr_metadata: dict) -> str:
257
267
# Add author thanks if available
258
268
authors_to_thank = []
259
269
if pr_author :
260
- # Check if pr_author already contains @ symbol
270
+ # Only add @ if we have a GitHub username, not a display name
261
271
if pr_author .startswith ("@" ):
262
272
authors_to_thank .append (pr_author )
263
- else :
273
+ elif pr_author_is_username :
264
274
authors_to_thank .append (f"@{ pr_author } " )
275
+ else :
276
+ # Display name from git - don't add @
277
+ authors_to_thank .append (pr_author )
265
278
266
279
# Add co-authors
267
280
for co_author in co_authors :
268
281
if co_author .startswith ("@" ):
269
282
authors_to_thank .append (co_author )
270
- else :
283
+ elif co_authors_are_usernames :
271
284
authors_to_thank .append (f"@{ co_author } " )
285
+ else :
286
+ # Display names from git - don't add @
287
+ authors_to_thank .append (co_author )
272
288
273
289
if authors_to_thank :
274
290
if len (authors_to_thank ) == 1 :
0 commit comments