-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GitHub] Issue and pull request detail and check state #1114
Conversation
service-tests/github.js
Outdated
.expectJSONTypes(Joi.object().keys({ name: 'updated', value: validDateString })); | ||
|
||
t.create('github pull request check state') | ||
.get('/pulls/checks/s/badges/shields/1110.json') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could make this /status/s/pulls/badges/shields/1110.json
which might be nicer for adding check state of branches + commits, as in #774.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated: c727f2f.
server.js
Outdated
// GitHub issue detail integration. | ||
camp.route(/^\/github\/(?:issues|pulls)\/detail\/(s|title|u|label|comments|age|last-update)\/([^\/]+)\/([^\/]+)\/(\d+)\.(svg|png|gif|jpg|json)$/, | ||
cache((queryParams, match, sendBadge, request) => { | ||
const stateColor = s => ({ open: '2cbe4e', closed: 'cb2431', merged: '6f42c1' }[s]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to re-define the function ever time this route is called, which is not really necessary as it's entirely static. Instead, pull this function out and make it a regular function in this file (or in one of the utility modules).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 448e88c.
# Conflicts: # server.js
# Conflicts: # package.json # service-tests/github.js
Service tests passing locally with this patch that works around a bug in our logic for token rate limit handling. |
This adds badges for Github issues and pull requests. You can display the state, title, username, number of comments, age, time since last update, and state of checks.
Blocked on #1112 (see FIXMEs).
Provides an endpoint the Shields CI can use to fetch PR titles for #979 and resolves #1011.