Skip to content

Add support for bot avatars#18001

Merged
sergiou87 merged 22 commits intodevelopmentfrom
bot-avatars
Feb 1, 2024
Merged

Add support for bot avatars#18001
sergiou87 merged 22 commits intodevelopmentfrom
bot-avatars

Conversation

@niik
Copy link
Member

@niik niik commented Jan 11, 2024

Closes #12766

Description

This adds support for loading avatars of "bot accounts", i.e. integrations by means of resolving the user model via the API and using the avatarURL from it. Ideally the avatars endpoint would support resolving this directly from the stealth email but it doesn't so we'll do this little dance to get around it.

Bot avatars are loaded via the id of the integration (i.e. GitHub App) that they belong to. That id is static which means we can preload some known avatars (on GitHub.com only, not GHES) to avoid having to do an API hit when we encounter them. For now I've added the dependabot, github-actions, and github-pages bots and we can add more as we encounter them later.

Screenshots

image

Release notes

Notes: [Fixed] Show avatars of bot accounts such as dependabot

Copy link
Member

@sergiou87 sergiou87 left a comment

Choose a reason for hiding this comment

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

Changes make sense, and it works fine in the small avatars, but for some reason the avatar doesn't show up in avatar tooltips:

image

*
* Most often used to check if an endpoint _isn't_ GitHub.com meaning it's
* either GitHub Enterprise Server or GitHub AE
* Whether or not the given endpoint belong's to GitHub.com
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
* Whether or not the given endpoint belong's to GitHub.com
* Whether or not the given endpoint belongs to GitHub.com

@sergiou87
Copy link
Member

I made a couple of fixes:

  1. The avatar tooltip for bots required our knownBots to have a name
  2. I centered the avatar in the tooltip
image

@sergiou87 sergiou87 requested a review from tidy-dev January 30, 2024 12:32
const knownAvatars: ReadonlyArray<IAvatarUser> = [
...dotComBot('dependabot[bot]', 49699333, 29110),
...dotComBot('github-actions[bot]', 41898282, 15368),
...dotComBot('github-pages[bot] ', 52472962, 34598),
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why the github-pages[bot] has space after it's login?

Copy link
Member

Choose a reason for hiding this comment

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

🤯 and it's a tab, not just a bunch of spaces

I didn't notice it, nice catch! It might have been an issue interacting with the IDE for autocompletion / Copilot suggestions. I'll remove it. Thanks 🙏

Co-Authored-By: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Copy link
Contributor

@tidy-dev tidy-dev left a comment

Choose a reason for hiding this comment

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

✨ Makes sense

@sergiou87 sergiou87 merged commit 3093f01 into development Feb 1, 2024
@sergiou87 sergiou87 deleted the bot-avatars branch February 1, 2024 10:07
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.

Dependabot's avatar is not shown

3 participants