Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const DEFAULTS = {
port: 5005,
template: builder,
indicies,
bots: true,
title: 'StatusBoard',
description: 'Project StatusBoard',
issueLabels: ['top priority', 'good first issue', 'help wanted', 'discussion', 'meeting']
Expand All @@ -40,6 +41,9 @@ class Config {
this.title = opts.title || DEFAULTS.title
this.description = opts.description || DEFAULTS.description

// Include bots in stats
this.bots = opts.bots === undefined ? DEFAULTS.bots : opts.bots

// Orgs
this.orgs = (opts.orgs || [])
.map((org) => new Organization(org))
Expand Down
1 change: 1 addition & 0 deletions template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
title: "<%= title %>",
description: "<%= description %>",
baseUrl: "<%= baseUrl %>",
bots: <%= bots %>,
issueLabels: <%- JSON.stringify(issueLabels) %>,
projects: <%- JSON.stringify(projects) %>,
files: <%- JSON.stringify(files) %>
Expand Down
20 changes: 17 additions & 3 deletions template/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,23 @@ require('nighthawk')({
.get('/', fetchIssues({ limit: 3 }), async (req, res) => {
// Turn user activity into a orderd list of 20
const userActivity = await (await fetch(`${config.baseUrl}/data/userActivity.json`)).json()
const u = Object.values(userActivity).sort((v1, v2) => {
return v1.activityCount < v2.activityCount ? 1 : v1.activityCount === v2.activityCount ? 0 : -1
}).slice(0, 20)
const u = Object.values(userActivity)
.filter(user => {
if (!config.bots && user?.type) {
return user.type !== 'Bot'
}

// Because the GitHub API doesn’t return a type for the Dependabot account
else if (!config.bots && user.login && user.login.endsWith('[bot]')) {
return false
}

return true
})
.sort((v1, v2) => {
return v1.activityCount < v2.activityCount ? 1 : v1.activityCount === v2.activityCount ? 0 : -1
})
.slice(0, 20)

render(html`
<statusboard-page .config="${config}">
Expand Down