Created
August 7, 2019 05:40
-
-
Save zeke/6aee6f50dc28e4cc9612d109094de4bd to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env node | |
const github = require('../lib/github')() | |
const owner = 'github' | |
const repo = 'help-docs' | |
const pull_number = 10230 | |
async function main () { | |
let { data:commits } = await github.pulls.listCommits({ | |
owner, | |
repo, | |
pull_number | |
}) | |
commits = commits.map(commit => { | |
return { | |
// sha: commit.sha, | |
date: new Date(commit.commit.author.date) | |
} | |
}) | |
commits.forEach((commit, index) => { | |
commit.secondsSincePreviousCommit = (commits.length > 1 && index > 0) | |
? (commit.date - commits[index-1].date) / 1000 | |
: null | |
}) | |
console.log(commits) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment