Skip to content

Instantly share code, notes, and snippets.

@adrianharabula
Created June 5, 2017 17:05
Show Gist options
  • Save adrianharabula/d1eb8eaf7a707aa5c13bdcb5ff47efc6 to your computer and use it in GitHub Desktop.
Save adrianharabula/d1eb8eaf7a707aa5c13bdcb5ff47efc6 to your computer and use it in GitHub Desktop.
Export github issues with ruby octokit
require 'octokit'
require 'json'
# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
# Instead, set and test environment variables, like below
client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
client.auto_paginate = true
issues = client.issues 'adrianharabula/condr', { :state => 'all' }
File.write('comments.json', issues.map(&:to_h).to_json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment