Skip to content

gh pr view and gh issue view: show friendly display names for all actors#12854

Merged
BagToad merged 4 commits intotrunkfrom
kw/pr-view-copilot-friendly-name
Mar 7, 2026
Merged

gh pr view and gh issue view: show friendly display names for all actors#12854
BagToad merged 4 commits intotrunkfrom
kw/pr-view-copilot-friendly-name

Conversation

@BagToad
Copy link
Member

@BagToad BagToad commented Mar 6, 2026

Description

gh pr view and gh issue view currently display raw bot logins like copilot-pull-request-reviewer and Copilot for Copilot's reviewer/assignee status and comments, and don't show user names alongside logins. This adds a generic actorDisplayName function that produces user-friendly display names for all actor types, and wires it into all display paths across both commands.

Key changes

  • actorDisplayName(typeName, login, name): New unexported function in api/queries_repo.go that handles all actor display name logic in one place. Known Copilot logins → Copilot (AI), regular bots → login, users with names → login (Name), fallback → login.
  • DisplayName() on all actor types: Author, CommentAuthor, GitHubUser, AssignableUser, AssignableBot, RequestedReviewer, and ReviewerBot all delegate to actorDisplayName with their available fields.
  • PullRequestReview.AuthorLogin() and Comment.AuthorLogin(): Now return friendly names via their type's DisplayName().
  • gh pr view: parseReviewers(), prAssigneeList(), and author display all use DisplayName().
  • gh issue view: issueAssigneeList() and author display use DisplayName().

Notes for reviewers

  • The translation only affects human-readable display output. JSON output via --json is unaffected — it still returns raw logins from the API.
  • actorDisplayName handles three known Copilot logins: copilot-pull-request-reviewer (code review), copilot-swe-agent (assignment via suggestedActors), and Copilot (assignment via legacy assignees field).
  • The parseReviewers() change switches review requests from LoginOrSlug() to DisplayName() — no behavioral change for non-Copilot reviewers since DisplayName() returns the same values for teams and regular users.

Acceptance testing

github.com (8 scenarios, 8/8 passed): Acceptance test results

@BagToad BagToad self-assigned this Mar 6, 2026
@BagToad BagToad force-pushed the kw/pr-view-copilot-friendly-name branch from ad4fc1d to b4305e0 Compare March 6, 2026 18:09
Add CopilotDisplayName helper that translates known Copilot bot
logins (copilot-pull-request-reviewer, copilot-swe-agent) to the
friendly 'Copilot (AI)' display name. Applied to:

- PullRequestReview.AuthorLogin() — review comment author
- Comment.AuthorLogin() — PR/issue comment author
- parseReviewers() in pr view — reviewer list display

This ensures gh pr view shows 'Copilot (AI)' instead of the raw
'copilot-pull-request-reviewer' login for both the reviewer status
line and any review comments left by Copilot.

Co-authored-by: Copilot <[email protected]>
@BagToad BagToad force-pushed the kw/pr-view-copilot-friendly-name branch 4 times, most recently from 2bfab5b to 57d1dd7 Compare March 6, 2026 18:48
Replace copilotDisplayName with actorDisplayName(typeName, login, name)
which handles all actor types: known bots get friendly names (e.g.
Copilot → 'Copilot (AI)'), regular bots return login, users with
names return 'login (Name)', others return login.

All DisplayName() methods on Author, CommentAuthor, GitHubUser,
AssignableUser, AssignableBot, RequestedReviewer, and ReviewerBot
now delegate to actorDisplayName with their available fields.

Co-authored-by: Copilot <[email protected]>
@BagToad BagToad force-pushed the kw/pr-view-copilot-friendly-name branch from 57d1dd7 to 7198d27 Compare March 6, 2026 18:56
@BagToad BagToad changed the title gh pr view shows friendly Copilot (AI) name instead of raw login gh pr view: show friendly display names for Copilot and other actors Mar 6, 2026
Apply DisplayName() to author and assignee display in issue view,
consistent with the pr view changes.

Co-authored-by: Copilot <[email protected]>
@BagToad BagToad changed the title gh pr view: show friendly display names for Copilot and other actors gh pr view and gh issue view: show friendly display names for all actors Mar 6, 2026
@BagToad BagToad marked this pull request as ready for review March 6, 2026 19:07
@BagToad BagToad requested a review from a team as a code owner March 6, 2026 19:07
@BagToad BagToad requested review from Copilot and williammartin March 6, 2026 19:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the human-readable output of gh pr view and gh issue view by introducing centralized “friendly” actor display-name formatting (including special-casing Copilot) and using it across author/assignee/reviewer display paths.

Changes:

  • Adds a shared actorDisplayName(typeName, login, name) helper and updates multiple actor types’ DisplayName() methods to delegate to it.
  • Switches gh pr view and gh issue view author/assignee/reviewer rendering to use DisplayName() rather than raw logins.
  • Updates AuthorLogin() for PR reviews and comments to return the friendly display string; adds unit tests for actorDisplayName.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/cmd/pr/view/view.go Uses DisplayName()/friendly author login in PR preview and reviewer/assignee lists.
pkg/cmd/issue/view/view.go Uses DisplayName() for issue author and assignee display.
api/queries_repo.go Introduces actorDisplayName; updates assignable actor display-name logic; adds GitHubUser.DisplayName().
api/queries_repo_test.go Adds unit tests for the new actorDisplayName helper.
api/queries_pr_review.go Switches review AuthorLogin() and reviewer display-name formatting to the shared helper.
api/queries_issue.go Adds DisplayName() methods for issue Author and CommentAuthor.
api/queries_comments.go Switches comment AuthorLogin() to return the friendly display name.
Comments suppressed due to low confidence (2)

api/queries_repo.go:1169

  • AssignableBot.DisplayName passes the string literal "Bot" into actorDisplayName. Since actorDisplayName compares typeName to the botTypeName constant, using the constant here would keep behavior coupled and prevent subtle mismatches if the typename handling changes.
func (b AssignableBot) DisplayName() string {
	return actorDisplayName("Bot", b.login, "")
}

pkg/cmd/pr/view/view.go:372

  • parseReviewers now uses reviewer display names as the map key. Since review authors currently only have login available (no name on CommentAuthor), but review requests can include name and thus RequestedReviewer.DisplayName() may return login (Name), the same actor can end up with two separate entries (e.g. octocat and octocat (Mona Lisa)), and the “overwrite” behavior for existing requests vs reviews no longer works reliably. Use a stable identifier (login for users/bots, org/slug for teams, or id if available) as the map key, and keep the friendly string only for display.
func parseReviewers(pr api.PullRequest) []*reviewerState {
	reviewerStates := make(map[string]*reviewerState)

	for _, review := range pr.Reviews.Nodes {
		if review.Author.Login != pr.Author.Login {
			name := review.AuthorLogin()
			if name == "" {
				name = ghostName
			}
			reviewerStates[name] = &reviewerState{
				Name:  name,
				State: review.State,
			}
		}
	}

	// Overwrite reviewer's state if a review request for the same reviewer exists.
	for _, reviewRequest := range pr.ReviewRequests.Nodes {
		name := reviewRequest.RequestedReviewer.DisplayName()
		reviewerStates[name] = &reviewerState{
			Name:  name,
			State: requestedReviewState,
		}
	}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just some minor notes.

- Add actorDisplayName call in CommentAuthor.DisplayName for consistency
- Use require.Equal in TestActorDisplayName instead of manual comparisons
- Simplify user type name constant usage

Co-authored-by: Copilot <[email protected]>
@BagToad BagToad merged commit 59ba508 into trunk Mar 7, 2026
10 of 11 checks passed
@BagToad BagToad deleted the kw/pr-view-copilot-friendly-name branch March 7, 2026 03:45
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 24, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cli/cli](https://github.com/cli/cli) | minor | `v2.87.3` → `v2.88.1` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>cli/cli (cli/cli)</summary>

### [`v2.88.1`](https://github.com/cli/cli/releases/tag/v2.88.1): GitHub CLI 2.88.1

[Compare Source](cli/cli@v2.88.0...v2.88.1)

#### Fix `pr` commands failing with `read:project` scope error

v2.88.0 introduced a regression where `pr` commands would fail with the error:

```
error: your authentication token is missing required scopes [read:project]
To request it, run:  gh auth refresh -s read:project
```

Previously, missing read:project scope was gracefully handled, and project data was silently skipped. A change inadvertently broke the error matching that enabled this graceful degradation. v2.88.1 reverts these changes so that `pr` commands work correctly without requiring the `read:project` scope.

#### What's Changed

- Migrate Windows code signing from client secret to OIDC by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;12911](cli/cli#12911)
- Revert "refactor: deduplicate scope error handling between api/client.go and project queries" by [@&#8203;williammartin](https://github.com/williammartin) in [#&#8203;12914](cli/cli#12914)
- Revert "fix: clarify scope error while creating issues for projects" by [@&#8203;williammartin](https://github.com/williammartin) in [#&#8203;12915](cli/cli#12915)

**Full Changelog**: <cli/cli@v2.88.0...v2.88.1>

### [`v2.88.0`](https://github.com/cli/cli/releases/tag/v2.88.0): GitHub CLI 2.88.0

[Compare Source](cli/cli@v2.87.3...v2.88.0)

#### :copilot: Request Copilot Code Review from `gh`

<img width="80%" height="80%" alt="image" src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://github.com/user-attachments/assets/c9b86700-5934-44b6-9210-227495a18d8e">https://github.com/user-attachments/assets/c9b86700-5934-44b6-9210-227495a18d8e" />

`gh pr create` and `gh pr edit` now support [Copilot Code Review](https://docs.github.com/en/copilot/using-github-copilot/code-review/using-copilot-code-review) as a reviewer. Request a review with `--add-reviewer @&#8203;copilot`, or select Copilot interactively from the searchable reviewer prompt.

Create a pull request and request review from Copilot:

```
gh pr create --reviewer @&#8203;copilot
```

Edit a pull request and request review from Copilot:

```
gh pr edit --add-reviewer @&#8203;copilot
```

#### Close issues as duplicates with `gh issue close --duplicate-of`

You can now close issues as duplicates and link to a duplicate issue directly from the CLI. The new `--duplicate-of` flag accepts an issue number or URL and marks the closed issue as a duplicate of the referenced one. You can also use `--reason duplicate` to set the close reason without linking a specific issue.

```

# Close as duplicate, linking to the original issue
gh issue close 123 --duplicate-of 456

# Close with duplicate reason only
gh issue close 123 --reason duplicate
```

#### JSON support for `gh agent-task`

`gh agent-task list` and `gh agent-task view` now support `--json`, `--jq`, and `--template` flags, consistent with other `gh` commands.

```
gh agent-task list --json id,name,state
gh agent-task view <id> --json state --jq '.state'
```

#### What's Changed

##### ✨ Features

- `gh pr create`: login-based reviewer requests and search-based interactive selection by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;12627](cli/cli#12627)
- `gh pr view` and `gh issue view`: show friendly display names for all actors by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;12854](cli/cli#12854)
- `gh issue close`: add `--duplicate-of` flag and duplicate reason by [@&#8203;tksohishi](https://github.com/tksohishi) in [#&#8203;12811](cli/cli#12811)
- `gh pr diff`: add `--exclude` flag to filter files from diff output by [@&#8203;yuvrajangadsingh](https://github.com/yuvrajangadsingh) in [#&#8203;12655](cli/cli#12655)
- `gh pr view/list`: add `changeType` field to files JSON output by [@&#8203;yuvrajangadsingh](https://github.com/yuvrajangadsingh) in [#&#8203;12657](cli/cli#12657)
- `gh repo clone`: add `--no-upstream` flag by [@&#8203;4RH1T3CT0R7](https://github.com/4RH1T3CT0R7) in [#&#8203;12686](cli/cli#12686)
- `gh repo edit`: add `--squash-merge-commit-message` flag by [@&#8203;yuvrajangadsingh](https://github.com/yuvrajangadsingh) in [#&#8203;12846](cli/cli#12846)
- `gh browse`: add `--blame` flag by [@&#8203;masonmcelvain](https://github.com/masonmcelvain) in [#&#8203;11486](cli/cli#11486)
- `gh agent-task list`: add `--json` support by [@&#8203;maxbeizer](https://github.com/maxbeizer) in [#&#8203;12806](cli/cli#12806)
- `gh agent-task view`: add `--json` support by [@&#8203;maxbeizer](https://github.com/maxbeizer) in [#&#8203;12807](cli/cli#12807)
- `gh copilot`: set `COPILOT_GH` env var when launching Copilot CLI by [@&#8203;devm33](https://github.com/devm33) in [#&#8203;12821](cli/cli#12821)

##### 🐛 Fixes

- Fix `gh project item-edit` error when editing Draft Issue with only one (`--title`/`--body`) flag by [@&#8203;ManManavadaria](https://github.com/ManManavadaria) in [#&#8203;12787](cli/cli#12787)
- Fix extension install error message showing raw struct instead of `owner/repo` by [@&#8203;Copilot](https://github.com/Copilot) in [#&#8203;12836](cli/cli#12836)
- Fix incorrect integer conversion from int to uint16 in port forwarder by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;12831](cli/cli#12831)
- Fix invalid ANSI SGR escape code in JSON and diff colorization by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;12720](cli/cli#12720)
- Fix assignees `databaseId` always being `0` in `--json` output by [@&#8203;srt32](https://github.com/srt32) in [#&#8203;12783](cli/cli#12783)
- Fix error when `--remote` flag used with repo argument by [@&#8203;majiayu000](https://github.com/majiayu000) in [#&#8203;12375](cli/cli#12375)
- Fix redundant API call in `gh issue view --comments` by [@&#8203;VishnuVV27](https://github.com/VishnuVV27) in [#&#8203;12652](cli/cli#12652)
- Clarify scope error while creating issues for projects by [@&#8203;elijahthis](https://github.com/elijahthis) in [#&#8203;12596](cli/cli#12596)
- Reject pull request-only search qualifiers in `gh issue list` by [@&#8203;LouisLau-art](https://github.com/LouisLau-art) in [#&#8203;12623](cli/cli#12623)
- Prevent `.git/config` corruption on repeated `issue develop --name` invocation by [@&#8203;gunadhya](https://github.com/gunadhya) in [#&#8203;12651](cli/cli#12651)
- Use pre-compiled regexp for matching Content-Type by [@&#8203;itchyny](https://github.com/itchyny) in [#&#8203;12781](cli/cli#12781)
- Isolate generated licenses per platform (os/arch) by [@&#8203;babakks](https://github.com/babakks) in [#&#8203;12774](cli/cli#12774)

##### 📚 Docs & Chores

- Add examples to `gh issue close` help text by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;12830](cli/cli#12830)
- Customizable install `prefix` in Makefile by [@&#8203;scarf005](https://github.com/scarf005) in [#&#8203;11714](cli/cli#11714)
- Deduplicate scope error handling between `api/client.go` and project queries by [@&#8203;yuvrajangadsingh](https://github.com/yuvrajangadsingh) in [#&#8203;12845](cli/cli#12845)
- Remove unnecessary `StateReason` and `StateReasonDuplicate` feature detection by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;12838](cli/cli#12838)
- Update Go version requirement to 1.26+ by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;12864](cli/cli#12864)
- Add monthly pitch surfacing workflow by [@&#8203;tidy-dev](https://github.com/tidy-dev) in [#&#8203;12894](cli/cli#12894)

##### :dependabot: Dependencies

- Bump Go from 1.25.7 to 1.26.1 by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;12860](cli/cli#12860)
- chore(deps): bump golang.org/x/sync from 0.19.0 to 0.20.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12886](cli/cli#12886)
- chore(deps): bump google.golang.org/grpc from 1.79.1 to 1.79.2 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12851](cli/cli#12851)
- chore(deps): bump github.com/docker/cli from 29.0.3+incompatible to 29.2.0+incompatible by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12842](cli/cli#12842)
- chore(deps): bump google.golang.org/grpc from 1.78.0 to 1.79.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12759](cli/cli#12759)
- chore(deps): bump goreleaser/goreleaser-action from 6.4.0 to 7.0.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12760](cli/cli#12760)
- chore(deps): bump actions/upload-artifact from 6 to 7 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12797](cli/cli#12797)
- chore(deps): bump actions/download-artifact from 7 to 8 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12796](cli/cli#12796)
- chore(deps): bump actions/attest-build-provenance from 3.2.0 to 4.1.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12795](cli/cli#12795)
- chore(deps): bump github.com/gabriel-vasile/mimetype from 1.4.11 to 1.4.13 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12615](cli/cli#12615)

#### New Contributors

- [@&#8203;srt32](https://github.com/srt32) made their first contribution in [#&#8203;12783](cli/cli#12783)
- [@&#8203;itchyny](https://github.com/itchyny) made their first contribution in [#&#8203;12781](cli/cli#12781)
- [@&#8203;VishnuVV27](https://github.com/VishnuVV27) made their first contribution in [#&#8203;12652](cli/cli#12652)
- [@&#8203;elijahthis](https://github.com/elijahthis) made their first contribution in [#&#8203;12596](cli/cli#12596)
- [@&#8203;ManManavadaria](https://github.com/ManManavadaria) made their first contribution in [#&#8203;12787](cli/cli#12787)
- [@&#8203;maxbeizer](https://github.com/maxbeizer) made their first contribution in [#&#8203;12806](cli/cli#12806)
- [@&#8203;LouisLau-art](https://github.com/LouisLau-art) made their first contribution in [#&#8203;12623](cli/cli#12623)
- [@&#8203;4RH1T3CT0R7](https://github.com/4RH1T3CT0R7) made their first contribution in [#&#8203;12686](cli/cli#12686)
- [@&#8203;yuvrajangadsingh](https://github.com/yuvrajangadsingh) made their first contribution in [#&#8203;12657](cli/cli#12657)
- [@&#8203;masonmcelvain](https://github.com/masonmcelvain) made their first contribution in [#&#8203;11486](cli/cli#11486)
- [@&#8203;scarf005](https://github.com/scarf005) made their first contribution in [#&#8203;11714](cli/cli#11714)
- [@&#8203;tksohishi](https://github.com/tksohishi) made their first contribution in [#&#8203;12811](cli/cli#12811)
- [@&#8203;tidy-dev](https://github.com/tidy-dev) made their first contribution in [#&#8203;12894](cli/cli#12894)

**Full Changelog**: <cli/cli@v2.87.3...v2.88.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My42MS43IiwidXBkYXRlZEluVmVyIjoiNDMuNjQuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants