From: Alexander Wirt Date: Sat, 15 Dec 2012 08:47:14 +0000 (+0100) Subject: Retidy X-Git-Url: http://git.grml.org/?p=grml-infrastructure.git;a=commitdiff_plain;h=de47017ee3a7e4d7ac784c6d64150a50720f8a3c Retidy --- diff --git a/tools/github b/tools/github index 0232c9f..a486314 100755 --- a/tools/github +++ b/tools/github @@ -7,10 +7,9 @@ use File::Slurp qw ( slurp ); use Data::Dumper; use Net::GitHub; +my $token = slurp( File::HomeDir->my_home . "/.github-token" ); -my $token = slurp(File::HomeDir->my_home . "/.github-token"); - -my $gh = Net::GitHub->new( # Net::GitHub::V3 +my $gh = Net::GitHub->new( # Net::GitHub::V3 access_token => $token ); @@ -18,10 +17,11 @@ my @repos = $gh->repos->list_org('grml'); foreach my $repo (@repos) { say $repo->{name}; - say "-" x length($repo->{name}); - my @hooks = $gh->repos->hooks('grml', $repo->{name}); + say "-" x length( $repo->{name} ); + my @hooks = $gh->repos->hooks( 'grml', $repo->{name} ); my $found = 0; foreach my $hook (@hooks) { + #warn Dumper($hook); next unless $hook->{name} eq 'web'; next unless $hook->{config}->{url} eq "http://git.grml.org/github"; @@ -29,16 +29,22 @@ foreach my $repo (@repos) { } if ($found) { say "git.grml.org hook already configured"; - } else { - my $rc = $gh->repos->create_hook('grml', $repo->{name}, { - name => 'web', + } + else { + my $rc = $gh->repos->create_hook( + 'grml', + $repo->{name}, + { + name => 'web', active => 1, config => { 'content_type' => 'form', - 'url' => 'http://git.grml.org/github' + 'url' => 'http://git.grml.org/github' } - }); - say "Hook created" if $rc->{config}->{url} eq "http://git.grml.org/github"; + } + ); + say "Hook created" + if $rc->{config}->{url} eq "http://git.grml.org/github"; } say; }