File: add_team_repos.pl

package info (click to toggle)
libnet-github-perl 1.05-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 376 kB
  • sloc: perl: 2,073; makefile: 8
file content (24 lines) | stat: -rw-r--r-- 653 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use strict;
use warnings;
use FindBin qw/$Bin/;
use lib "$Bin/../lib";
use Net::GitHub::V3;
use Data::Dumper;

die unless ( ($ENV{GITHUB_USER} and $ENV{GITHUB_PASS}) or $ENV{GITHUB_ACCESS_TOKEN} );

# either user+pass or token
my $gh = Net::GitHub::V3->new( login => $ENV{GITHUB_USER}, pass => $ENV{GITHUB_PASS});
# my $gh = Net::GitHub->new( access_token => $ENV{GITHUB_ACCESS_TOKEN});

my $x = $gh->repos->create({
    name => "Foo-Bar-Baz",
    org => "Yoink", 
});

$gh->org->add_team_repos($team_id, "Yoink/Foo-Bar-Baz", { permission => 'admin' })
  or die ("Could not add or update team on repository with permission admin");

1;