Skip to content

Instantly share code, notes, and snippets.

@tomas-stefano
Last active May 30, 2017 13:20
Show Gist options
  • Save tomas-stefano/2965a498295eacf79ff86c6be56cf030 to your computer and use it in GitHub Desktop.
Save tomas-stefano/2965a498295eacf79ff86c6be56cf030 to your computer and use it in GitHub Desktop.
PRs list from mas

PRS

Simple script to list all PRs in an organisation.

Running

TO run the script you will need to pass an environment variable.

GH_AUTH_TOKEN=YOUR_GIT_AUTH_TOKEN ./prs
gem 'octokit'
#!/usr/bin/env ruby
require 'octokit'
client = Octokit::Client.new(access_token: ENV['GH_AUTH_TOKEN'])
mas = 'moneyadviceservice'
repositories = client.organization_repositories(mas, per_page: 200)
repositories.map do |repository|
repository_name = "#{mas}/#{repository.name}"
pulls = client.pull_requests(repository_name, state: 'open')
next if pulls.empty?
pulls.each do |pull|
puts "#{pull.title} - #{pull.html_url}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment