Skip to content

Instantly share code, notes, and snippets.

@pocke
Last active December 31, 2019 06:30
Show Gist options
  • Save pocke/6f833d431f419eb09bdd6beb0b5ee637 to your computer and use it in GitHub Desktop.
Save pocke/6f833d431f419eb09bdd6beb0b5ee637 to your computer and use it in GitHub Desktop.
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