Skip to content

Instantly share code, notes, and snippets.

@dy-dx
Created December 9, 2013 16:50
Show Gist options
  • Save dy-dx/7875668 to your computer and use it in GitHub Desktop.
Save dy-dx/7875668 to your computer and use it in GitHub Desktop.
node.js script for listing closed + unmerged pull requests. Useful for tracking closed pull requests that may have been forgotten.
# Configuration
cfg =
oauth_token: ''
repo: 'viewthespace/viewthespace'
number_of_pulls: 40
timeout: 5000
unless cfg.oauth_token.length
return console.error """
Please generate an oauth token and place in cfg object.
https://github.com/settings/tokens/new
"""
require('date-utils')
GitHubApi = require("github")
github = new GitHubApi
version: "3.0.0"
timeout: cfg.timeout
github.authenticate
type: "oauth"
token: cfg.oauth_token
github.pullRequests.getAll
user: cfg.repo.split('/')[0]
repo: cfg.repo.split('/')[1]
state: "closed"
page: "1"
per_page: cfg.number_of_pulls
,
(err, res) ->
if err then return console.error err
for pr in res when not pr.merged_at
console.log ""
console.log "#{pr.user.login} - #{pr.title}"
console.log "Closed at: #{(new Date(pr.closed_at)).toFormat('MMM D, H:MIP')}"
console.log "#{pr.html_url}"
{
"name": "vts-closed-pulls",
"version": "0.0.0",
"description": "",
"main": "index.coffee",
"dependencies": {
"coffee-script": "~1.6.3",
"github": "~0.1.12",
"date-utils": "~1.2.14"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment