add stats on activity in last 24 hours

This commit is contained in:
Fred K. Schott 2021-09-01 17:04:39 -07:00
parent 287eee766f
commit 8483f29b23
2 changed files with 24 additions and 4 deletions

View file

@ -65,19 +65,39 @@ export async function run() {
const twentyFourHoursAgo = new Date(); const twentyFourHoursAgo = new Date();
twentyFourHoursAgo.setDate(twentyFourHoursAgo.getDate() - 1); twentyFourHoursAgo.setDate(twentyFourHoursAgo.getDate() - 1);
const pulls = await octokit.paginate('GET /repos/{owner}/{repo}/pulls', { const allIssues = await octokit.paginate('GET /repos/{owner}/{repo}/issues', {
owner, owner,
repo, repo,
}); });
const issues = await octokit.paginate('GET /repos/{owner}/{repo}/issues', { const issues = allIssues.filter((iss) => !iss.pull_request);
const pulls = allIssues.filter((iss) => iss.pull_request);
const allIssuesLastTwentyFourHours = await octokit.paginate('GET /repos/{owner}/{repo}/issues', {
owner, owner,
repo, repo,
state: 'all',
per_page: 100,
since: twentyFourHoursAgo.toISOString(),
}); });
const issuesLastTwentyFourHours = allIssuesLastTwentyFourHours.filter((iss) => new Date(iss.created_at) > twentyFourHoursAgo && !iss.pull_request);
const pullsLastTwentyFourHours = allIssuesLastTwentyFourHours.filter((iss) => new Date(iss.created_at) > twentyFourHoursAgo && iss.pull_request);
console.log(issuesLastTwentyFourHours, pullsLastTwentyFourHours);
const entry = [ const entry = [
// Date (Human Readable) // Date (Human Readable)
`"${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}"`, `"${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}"`,
// Commits in last 24 hours // Commits in last 24 hours
(await countCommits(twentyFourHoursAgo)).length, (await countCommits(twentyFourHoursAgo)).length,
// New Issues(All) in last 24 hours
issuesLastTwentyFourHours.length,
// New Issues(Bugs) in last 24 hours
issuesLastTwentyFourHours.filter((iss) => iss.title.startsWith('🐛 BUG:')).length,
// New Issues(RFC) in last 24 hours
issuesLastTwentyFourHours.filter((iss) => iss.title.startsWith('💡 RFC:')).length,
// New Issues(Docs) in last 24 hours
issuesLastTwentyFourHours.filter((iss) => iss.title.startsWith('📘 DOC:')).length,
// New Pull Requests in last 24 hours
pullsLastTwentyFourHours.length,
// Pull requests // Pull requests
pulls.length, pulls.length,
// Open Issues // Open Issues

View file

@ -1,2 +1,2 @@
Date,Commits (24hr),Open PRs,Open Issues,Bugs: Needs Triage,Bugs: Accepted,RFC: Needs Discussion,RFC: In Progress,RFC: Accepted,Date (ISO) Date,Commits (24hr),Issues (24hr),Issues:BUG (24hr),Issues:RFC (24hr),Issues:DOC (24hr),PRs (24hr),Open PRs,Open Issues,Bugs: Needs Triage,Bugs: Accepted,RFC: Needs Discussion,RFC: In Progress,RFC: Accepted,Date (ISO)
"Wednesday, September 1, 2021",10,10,172,3,64,15,18,12,"2021-09-01T12:04:47.572Z" "Wednesday, September 1, 2021",21,4,3,1,0,8,7,166,3,54,36,0,12,"2021-09-02T00:02:50.708Z"

1 Date Commits (24hr) Issues (24hr) Issues:BUG (24hr) Issues:RFC (24hr) Issues:DOC (24hr) PRs (24hr) Open PRs Open Issues Bugs: Needs Triage Bugs: Accepted RFC: Needs Discussion RFC: In Progress RFC: Accepted Date (ISO)
2 Wednesday, September 1, 2021 10 21 4 3 1 0 8 10 7 172 166 3 64 54 15 36 18 0 12 2021-09-01T12:04:47.572Z 2021-09-02T00:02:50.708Z