Created
January 22, 2020 08:35
-
-
Save shibulijack-fd/b62786109d4894071971e2de2e9642c0 to your computer and use it in GitHub Desktop.
Github stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Octokit = require("@octokit/rest"); | |
const octokit = Octokit({ | |
auth: "GITHUB_AUTH_TOKEN", | |
userAgent: "gh-performyard v1.0.0", | |
baseUrl: "https://api.github.com" | |
}); | |
const owner = "freshdesk"; | |
const repo = "nucleus"; | |
octokit.pulls | |
.list({ | |
owner, | |
repo, | |
state: "closed", | |
base: "master", | |
sort: "created" | |
}) | |
.then(({ data, headers, status }) => { | |
let pulls = data; | |
console.log(`Total number of PRs: ${pulls.length}`); | |
pulls.length && | |
pulls.forEach(pr => { | |
console.log(`PR ${pr.number}`); | |
console.log(`TITLE: ${pr.title}`); | |
console.log(`DESCRIPTION: ${pr.body}`); | |
console.log(`=================================`); | |
}); | |
}); | |
octokit.activity | |
.listRepoEvents({ | |
owner, | |
repo | |
}) | |
.then(({ data, headers, status }) => { | |
let activities = data; | |
let reviewCount = 0; | |
activities.length && | |
activities.forEach(activity => { | |
if (activity.actor && activity.actor === owner) { | |
reviewCount += 1; | |
} | |
}); | |
console.log(`Total number of PR reviews: ${reviewCount}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment