Skip to content

Instantly share code, notes, and snippets.

@aroman
Created June 7, 2014 22:19
Show Gist options
  • Save aroman/44d7b85cbd954bd54616 to your computer and use it in GitHub Desktop.
Save aroman/44d7b85cbd954bd54616 to your computer and use it in GitHub Desktop.
require 'gitlab'
require 'octokit'
Gitlab.configure do |c|
c.endpoint = 'http://projects.elementaryos.org/api/v3' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT']
c.private_token = '<redacted>' # username for sudo mode, default: nil
end
gh = Octokit::Client.new(:access_token => '<redacted>')
GITLAB_PROJECT = 7 # web/ci-site
GITHUB_PROJECT = "elementary/org-issues"
Gitlab.issues(GITLAB_PROJECT, per_page => 100).each do |issue|
# puts issue.title
notes = Gitlab.issue_notes(GITLAB_PROJECT, issue.id)
description = "[@#{issue.author.username} (#{issue.author.name}) created on GitLab]\n\n#{issue.description}"
new_issue = gh.create_issue(GITHUB_PROJECT, issue.title, description)
notes.each do |note|
comment = "[@#{note.author.username} (#{note.author.name}) commented on GitLab]\n\n#{note.body}"
gh.add_comment(GITHUB_PROJECT, new_issue.number, comment)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment