Skip to content

Instantly share code, notes, and snippets.

@datenimperator
Created May 6, 2014 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save datenimperator/b7f703b3000fde24c2e3 to your computer and use it in GitHub Desktop.
Save datenimperator/b7f703b3000fde24c2e3 to your computer and use it in GitHub Desktop.
Display active, assigned tickets from Gitlab using Ruby
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
GITLAB='http://your.gitlabhost.com'
TOKEN='security_token'
USERNAME='your_username'
issues = JSON.load(open("#{GITLAB}/api/v3/issues?private_token=#{TOKEN}"))
issues
.reject{|i| i['state']=='closed'}
.reject{|i| i['assignee'].nil? || i['assignee']['username']!=USERNAME}
.group_by{|i| i['project_id'].to_i }
.each do |group|
project = JSON.load(open("#{GITLAB}/api/v3/projects/#{group[0]}?private_token=#{TOKEN}"))
puts project['name_with_namespace']
group[1].each do |issue|
puts " #{issue['id']}: #{issue['title']}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment