6 use File::Slurp qw ( slurp );
11 my $token = slurp(File::HomeDir->my_home . "/.github-token");
13 my $gh = Net::GitHub->new( # Net::GitHub::V3
14 access_token => $token
17 my @repos = $gh->repos->list_org('grml');
19 foreach my $repo (@repos) {
21 say "-" x length($repo->{name});
22 my @hooks = $gh->repos->hooks('grml', $repo->{name});
24 foreach my $hook (@hooks) {
26 next unless $hook->{name} eq 'web';
27 next unless $hook->{config}->{url} eq "http://git.grml.org/github";
31 say "git.grml.org hook already configured";
33 my $rc = $gh->repos->create_hook('grml', $repo->{name}, {
37 'content_type' => 'form',
38 'url' => 'http://git.grml.org/github'
41 say "Hook created" if $rc->{config}->{url} eq "http://git.grml.org/github";