Skip to content

Instantly share code, notes, and snippets.

@zeke
Created August 7, 2019 05:40
Show Gist options
  • Save zeke/6aee6f50dc28e4cc9612d109094de4bd to your computer and use it in GitHub Desktop.
Save zeke/6aee6f50dc28e4cc9612d109094de4bd to your computer and use it in GitHub Desktop.
#!/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