Created
September 3, 2012 15:08
-
-
Save moznion/3609964 to your computer and use it in GitHub Desktop.
Get number of pull-request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use 5.012; | |
use WebService::Simple; | |
my $target_username = "USER_NAME"; # <= input your self | |
my $target_reponame = "REPOSITORY_NAME"; # <= input your self | |
my $query = "pulls"; | |
my $github = WebService::Simple->new( | |
base_url => 'https://api.github.com/', | |
response_parser => 'JSON' | |
); | |
my $number_of_pull_requests = 0; | |
my $pull_requests = $github->get( "repos/$target_username/$target_reponame/$query" ); | |
my $parsed_pull_requests = $pull_requests->parse_response; | |
foreach my $list (@{ $parsed_pull_requests }) { | |
foreach my $key (keys %{ $list }) { | |
if ($key ~~ /number/) { | |
$number_of_pull_requests++; | |
} | |
} | |
} | |
say $number_of_pull_requests; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment