Skip to content

Use direct avatars.githubusercontent.com URL for contributor avatars#24

Draft
Copilot wants to merge 7 commits intomainfrom
copilot/add-avatars-in-contributors-column
Draft

Use direct avatars.githubusercontent.com URL for contributor avatars#24
Copilot wants to merge 7 commits intomainfrom
copilot/add-avatars-in-contributors-column

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

  • Replace mixed HTML/Markdown contributor cells with pure HTML anchor tags
  • Add alt attribute to <img> tags
  • Add ?s=64 size query to avatar URLs to reduce bandwidth
  • Extract _contributor_cell() helper to eliminate code duplication between tables
  • Validate login against GitHub's username pattern (_GITHUB_LOGIN_RE)
  • URL-encode login with urllib.parse.quote in href/src
  • HTML-escape login with html.escape in alt and display text
  • Tighten _GITHUB_LOGIN_RE to reject consecutive hyphens
  • Handle invalid logins gracefully (log warning + skip row instead of raising ValueError)

Copilot AI requested a review from jbampton April 27, 2026 14:33
@jbampton jbampton requested a review from Copilot April 27, 2026 14:37
@jbampton jbampton added this to Next Apr 27, 2026
@github-project-automation github-project-automation Bot moved this to In progress in Next Apr 27, 2026
@jbampton jbampton added the good first issue Good for newcomers label Apr 27, 2026
@jbampton
Copy link
Copy Markdown
Member

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the leaderboard generation script to include contributor avatars by replacing markdown links with HTML anchor and image tags. The review feedback recommends adding an empty alt attribute to the tags to improve accessibility, as the images are decorative and redundant with the username text.

Comment thread scripts/leaderboard.py Outdated
Comment thread scripts/leaderboard.py Outdated
Copy link
Copy Markdown
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

Updates the markdown generation in scripts/leaderboard.py to render contributor cells using pure HTML (link + avatar + handle) rather than Markdown links, aligning the leaderboard output with the intended HTML-only formatting.

Changes:

  • Introduces an HTML contributor_cell (<a><img><br>@login</a>) for the main leaderboard table.
  • Applies the same HTML contributor cell rendering to the “Extended Statistics” table.

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

Comment thread scripts/leaderboard.py Outdated
Comment thread scripts/leaderboard.py Outdated
Comment thread scripts/leaderboard.py Outdated
Comment thread scripts/leaderboard.py Outdated
Comment thread scripts/leaderboard.py Outdated
Copy link
Copy Markdown
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


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

Comment thread scripts/leaderboard.py Outdated
Copy link
Copy Markdown
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


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

Comment thread scripts/leaderboard.py Outdated
@jbampton jbampton requested a review from Copilot April 27, 2026 15:47
@jbampton
Copy link
Copy Markdown
Member

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot apply changes based on the comments in this thread

Done in c945a26. _GITHUB_LOGIN_RE is now ^(?=.{1,39}$)[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$, which enforces the 1–39 character limit and rejects consecutive hyphens (e.g. a--b), leading hyphens, and trailing hyphens.

Copy link
Copy Markdown
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


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

@jbampton
Copy link
Copy Markdown
Member

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the leaderboard script to generate HTML-based contributor cells with avatars and links, replacing the previous markdown format. It introduces GitHub username validation using a regular expression and ensures proper URL and HTML escaping. Feedback was provided regarding the use of a ValueError for invalid logins, which could cause the script to crash in a CI/CD environment; it is recommended to handle these cases more gracefully to avoid breaking the leaderboard generation.

Comment thread scripts/leaderboard.py Outdated
Comment on lines +721 to +722
if not _GITHUB_LOGIN_RE.match(login):
raise ValueError(f"Invalid GitHub login: {login!r}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Raising a ValueError here will cause the entire script to crash during the markdown generation phase if an invalid login is encountered (e.g., from a legacy account or a manual entry in EMAIL_ALIASES). Since this script likely runs in a CI/CD pipeline to update the README, a single invalid username would break the leaderboard for the whole organization.

Consider validating the login earlier in the pipeline (e.g., in build_leaderboard) and handling invalid entries gracefully by logging a warning and skipping the contributor or using a safe fallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants