Skip to content

Conversation

@ofir-frd
Copy link

Benchmark PR discourse#36313

Type: Clean (correct implementation)

Original PR Title: FEATURE: GitHub PR live status icon
Original PR Description: I wanted a better way to show a live/up-to-date status of a PR than what the https://github.com/discourse/github-status-theme provided.

First, I wanted it to work on any PR, including ones in private repositories.

Second, I wanted to include the approved status, which requires a 2nd call to GitHub's API.

Third, I wanted something that was less "intrusive" than the "shield-like" status, so I opted out to use the icons & color that GitHub uses (but maybe that's a bad idea).

So here's what I came up with. It's basically a small initializer script that hooks into the "decorate" APIs for posts and chat messages, and sends a requests to retrieve the PR status for each GitHub pull request oneboxes.

The server-side proxy is there to add the GitHub token (via the github_onebox_access_tokens site setting) to access private repositories as well as doing some post-processing to retrieve the approved status.

There is no caching, neither client-side, nor server-side, as I wanted to see how it felt in production and how often we would hit any rate limits.

BEFORE

BEFORE

AFTER

AFTER

Internal ref - t/17138
Original PR URL: discourse#36313

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants