summaryrefslogtreecommitdiff
path: root/scripts/stats/index.js
diff options
context:
space:
mode:
authorGravatar Fred K. Schott <fkschott@gmail.com> 2021-09-01 17:04:39 -0700
committerGravatar Fred K. Schott <fkschott@gmail.com> 2021-09-01 17:04:39 -0700
commit8483f29b23d832e2a88d8321fd5e7ce7517f7c45 (patch)
tree9668b81f8dab1c80401e2091c33a99d9c9a40cd6 /scripts/stats/index.js
parent287eee766fe047a7cfe6aedc2ede748b395aa7a5 (diff)
downloadastro-8483f29b23d832e2a88d8321fd5e7ce7517f7c45.tar.gz
astro-8483f29b23d832e2a88d8321fd5e7ce7517f7c45.tar.zst
astro-8483f29b23d832e2a88d8321fd5e7ce7517f7c45.zip
add stats on activity in last 24 hours
Diffstat (limited to 'scripts/stats/index.js')
-rw-r--r--scripts/stats/index.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/scripts/stats/index.js b/scripts/stats/index.js
index f13f1be2e..a621bfa3b 100644
--- a/scripts/stats/index.js
+++ b/scripts/stats/index.js
@@ -65,19 +65,39 @@ export async function run() {
const twentyFourHoursAgo = new Date();
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,
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,
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 = [
// Date (Human Readable)
`"${new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}"`,
// Commits in last 24 hours
(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
pulls.length,
// Open Issues