Skip to content

Instantly share code, notes, and snippets.

@pocke pocke/this-year-repos.rb
Last active Dec 31, 2019

Embed
What would you like to do?
Print repositories created this year
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'octokit'
end
name = ARGV[0] || `git config --get github.user`.chomp
year = ARGV[1] || Time.now.year
raise "ruby this-year-repos.rb USERNAME [YEAR]" if !name || name.empty?
c = Octokit::Client.new.tap{ |c|
c.per_page = 100
c.auto_paginate = true
}
puts c.search_repos("user:#{name} created:#{year}-01-01..#{year}-12-31").items.sort_by(&:created_at).map{|r|"https://github.com/#{r.full_name}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.