Put metacpan links and abstracts in your github repositories

This script copies the abstract and URL from metacpan to your github repositories.

#!/home/ben/software/install/bin/perl
use warnings;
use strict;
use MetaCPAN::Client;
use Pithub;

use constant GH_USER  => '%%%%';
use constant GH_TOKEN => '####';

my $repos = Pithub::Repos->new (
    user  => GH_USER,
    token => GH_TOKEN,
);

my $me = '!!!!!';
my $mcpan = MetaCPAN::Client->new();
my $author = $mcpan->author ($me);
my $releases = $author->releases ();
while (my $release = $releases->next ()) {
    my $abstract = $release->abstract ();
    my $url = $release->metacpan_url ();
    my $resources = $release->resources ();
    my $github = $resources->{repository}{url};
    print "$abstract\n";
    $url =~ s!$me/!!;
    $url =~ s!-[0-9\.]+!!;
    print "$url\n";
    print "$github\n";
    my $repo = $github;
    $repo =~ s!.*/!!;
    my $result = $repos->update (
        repo => $repo,
        data => {
            description => $abstract,
            homepage => $url,
        },
    );
}

(download)

Web links


Copyright © Ben Bullock 2009-2022. All rights reserved. For comments, questions, and corrections, please email Ben Bullock (benkasminbullock@gmail.com) or use the discussion group at Google Groups. / Privacy / Disclaimer