#!/usr/bin/perl # Do a "shallow clone" of every repo underneath https://github.com/orgs/github/repositories # which is a.... lot of code. (~5 GB, actually) use strict; use warnings; use Data::Dumper; #use Devel::Comments; # uncomment this during development to enable the ### debugging statements use Net::GitHub::V3 (); my $gh = Net::GitHub::V3->new( login => 'DeeNewcum', access_token => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ); my $repos = $gh->repos; open my $descriptions, '>', 'repo_descriptions.txt' or die $!; # add autoflush my $was = select($descriptions); $|++; select($was); while (my $repo = $repos->next_org_repo('github','public')) { #if ($repo->{name} eq 'docs') { # print Dumper $repo; exit; #} #print Dumper $repo; exit; next if ($repo->{archived}); print $descriptions "$repo->{name} -- $repo->{description}\n"; print "================ $repo->{ssh_url} ================\n"; # download a "shallow clone" system "git", "clone", "--depth=1", $repo->{ssh_url}; # if 'git' died from Ctrl-C, then we die too exit(1) if ($? & 127); }